[coverity] Don't crash on NULL arg in GetShortPathNameW

Mike Hearn mike at plan99.net
Thu Apr 6 15:46:33 CDT 2006


Mike Hearn <mike at plan99.net>
Don't crash on NULL arg in GetShortPathNameW

diff --git a/dlls/kernel/path.c b/dlls/kernel/path.c
index 66c1e84..4f5aa74 100644
--- a/dlls/kernel/path.c
+++ b/dlls/kernel/path.c
@@ -431,7 +431,7 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR 
     LPCWSTR             p;
     DWORD               sp = 0, lp = 0;
     DWORD               tmplen;
-    BOOL                unixabsolute = (longpath[0] == '/');
+    BOOL                unixabsolute;
     WIN32_FIND_DATAW    wfd;
     HANDLE              goit;
     UNICODE_STRING      ustr;
@@ -444,12 +444,15 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR 
         SetLastError(ERROR_INVALID_PARAMETER);
         return 0;
     }
+    
     if (!longpath[0])
     {
         SetLastError(ERROR_BAD_PATHNAME);
         return 0;
     }
 
+    unixabsolute = (longpath[0] == '/');    
+
     /* check for drive letter */
     if (!unixabsolute && longpath[1] == ':' )
     {



More information about the wine-patches mailing list