3 Dec
2006
3 Dec
'06
12:06 p.m.
"Marcus Meissner" <marcus(a)jet.franken.de> wrote:
- MultiByteToWideChar(CP_ACP,0,lpszPath,-1,szPath,MAX_PATH); + INT ret; + + ret = MultiByteToWideChar(CP_ACP,0,lpszPath,-1,NULL,0); + if (ret > MAX_PATH) { + FIXME("Too long path!\n"); + return FALSE; + } + ret = MultiByteToWideChar(CP_ACP,0,lpszPath,-1,szPath,sizeof(szPath)/sizeof(WCHAR));
It should be sufficient to check return value of MultiByteToWideChar to detect an overflow, there is no need to call MultiByteToWideChar twice for that. -- Dmitry.