"Marcus Meissner" <[EMAIL PROTECTED]> 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.
