Re: [PATCH] check length in path canonicalize
3 Dec
2006
3 Dec
'06
6:06 a.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.
6952
Age (days ago)
6952
Last active (days ago)
0 comments
1 participants
participants (1)
-
Dmitry Timoshkov