Paul Vriens : kernel32: Fix a crash with GetLongPathNameW and UNC path names.

Alexandre Julliard julliard at winehq.org
Thu Dec 17 10:37:12 CST 2009


Module: wine
Branch: master
Commit: d58bd680b195da55687cedaf0ab8b8781fb95bcd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d58bd680b195da55687cedaf0ab8b8781fb95bcd

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Thu Dec 17 10:44:05 2009 +0100

kernel32: Fix a crash with GetLongPathNameW and UNC path names.

---

 dlls/kernel32/path.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index e9463bb..7618dc9 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -313,9 +313,15 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen
 
     if (shortpath[0] == '\\' && shortpath[1] == '\\')
     {
-        ERR("UNC pathname %s\n", debugstr_w(shortpath));
-        lstrcpynW( longpath, shortpath, longlen );
-        return strlenW(longpath);
+        FIXME("UNC pathname %s\n", debugstr_w(shortpath));
+
+        tmplen = strlenW(shortpath);
+        if (tmplen < longlen)
+        {
+            if (longpath != shortpath) strcpyW( longpath, shortpath );
+            return tmplen;
+        }
+        return tmplen + 1;
     }
 
     unixabsolute = (shortpath[0] == '/');




More information about the wine-cvs mailing list