mirror of
https://github.com/reactos/reactos.git
synced 2024-07-11 07:05:12 +00:00
[shlwapi]
fix buffer overflow svn path=/trunk/; revision=63649
This commit is contained in:
parent
2c9a27ae40
commit
f4ec38eedf
|
@ -137,20 +137,21 @@ LPSTR WINAPI PathCombineA(LPSTR lpszDest, LPCSTR lpszDir, LPCSTR lpszFile)
|
||||||
if (!lpszDest)
|
if (!lpszDest)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!lpszDir && !lpszFile)
|
if (!lpszDir && !lpszFile)
|
||||||
{
|
goto fail;
|
||||||
lpszDest[0] = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lpszDir)
|
if (lpszDir)
|
||||||
MultiByteToWideChar(CP_ACP,0,lpszDir,-1,szDir,MAX_PATH);
|
if (!MultiByteToWideChar(CP_ACP,0,lpszDir,-1,szDir,MAX_PATH))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
if (lpszFile)
|
if (lpszFile)
|
||||||
MultiByteToWideChar(CP_ACP,0,lpszFile,-1,szFile,MAX_PATH);
|
if (!MultiByteToWideChar(CP_ACP,0,lpszFile,-1,szFile,MAX_PATH))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
if (PathCombineW(szDest, lpszDir ? szDir : NULL, lpszFile ? szFile : NULL))
|
if (PathCombineW(szDest, lpszDir ? szDir : NULL, lpszFile ? szFile : NULL))
|
||||||
if (WideCharToMultiByte(CP_ACP,0,szDest,-1,lpszDest,MAX_PATH,0,0))
|
if (WideCharToMultiByte(CP_ACP,0,szDest,-1,lpszDest,MAX_PATH,0,0))
|
||||||
return lpszDest;
|
return lpszDest;
|
||||||
|
|
||||||
|
fail:
|
||||||
lpszDest[0] = 0;
|
lpszDest[0] = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue