Mike Hearn : kernel: Correct SearchPathA argument validation.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Apr 7 13:30:54 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 679df54b6c39bc3f87c96400d42c402d924eb434
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=679df54b6c39bc3f87c96400d42c402d924eb434

Author: Mike Hearn <mike at plan99.net>
Date:   Fri Apr  7 17:15:44 2006 +0100

kernel: Correct SearchPathA argument validation.

---

 dlls/kernel/path.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel/path.c b/dlls/kernel/path.c
index 66c1e84..d3fd764 100644
--- a/dlls/kernel/path.c
+++ b/dlls/kernel/path.c
@@ -722,7 +722,7 @@ inline static BOOL contains_pathW (LPCWS
  * Searches for a specified file in the search path.
  *
  * PARAMS
- *    path	[I] Path to search
+ *    path	[I] Path to search (NULL means default)
  *    name	[I] Filename to search for.
  *    ext	[I] File extension to append to file name. The first
  *		    character must be a period. This parameter is
@@ -818,12 +818,13 @@ DWORD WINAPI SearchPathW( LPCWSTR path, 
 DWORD WINAPI SearchPathA( LPCSTR path, LPCSTR name, LPCSTR ext,
                           DWORD buflen, LPSTR buffer, LPSTR *lastpart )
 {
-    WCHAR *pathW, *nameW = NULL, *extW = NULL;
+    WCHAR *pathW = NULL, *nameW = NULL, *extW = NULL;
     WCHAR bufferW[MAX_PATH];
     DWORD ret;
 
-    if (name && !(nameW = FILE_name_AtoW( name, FALSE ))) return 0;
-    if (!(pathW = FILE_name_AtoW( path, TRUE ))) return 0;
+    if (!name || !(nameW = FILE_name_AtoW( name, FALSE ))) return 0;
+    if (path && !(pathW = FILE_name_AtoW( path, TRUE ))) return 0;
+    
     if (ext && !(extW = FILE_name_AtoW( ext, TRUE )))
     {
         HeapFree( GetProcessHeap(), 0, pathW );




More information about the wine-cvs mailing list