Commit f26874c5 authored by Christoph von Wittich's avatar Christoph von Wittich Committed by Alexandre Julliard

shlwapi: Avoid buffer overflow in PathCombineA.

parent 4b594361
......@@ -155,20 +155,21 @@ LPSTR WINAPI PathCombineA(LPSTR lpszDest, LPCSTR lpszDir, LPCSTR lpszFile)
if (!lpszDest)
return NULL;
if (!lpszDir && !lpszFile)
{
lpszDest[0] = 0;
return NULL;
}
goto fail;
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)
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 (WideCharToMultiByte(CP_ACP,0,szDest,-1,lpszDest,MAX_PATH,0,0))
return lpszDest;
fail:
lpszDest[0] = 0;
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment