Author: cwittich
Date: Fri Jun 27 18:08:00 2014
New Revision: 63649
URL:
http://svn.reactos.org/svn/reactos?rev=63649&view=rev
Log:
[shlwapi]
fix buffer overflow
Modified:
trunk/reactos/dll/win32/shlwapi/path.c
Modified: trunk/reactos/dll/win32/shlwapi/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/path.c?r…
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/path.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/path.c [iso-8859-1] Fri Jun 27 18:08:00 2014
@@ -137,20 +137,21 @@
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;
}