]> granicus.if.org Git - php/commitdiff
- remove 'UNC' from the target
authorPierre Joye <pajoye@php.net>
Fri, 10 Sep 2010 19:21:02 +0000 (19:21 +0000)
committerPierre Joye <pajoye@php.net>
Fri, 10 Sep 2010 19:21:02 +0000 (19:21 +0000)
TSRM/tsrm_virtual_cwd.c

index 1f115f6646fba8f6b3d5c34d750a1e3725527a5d..a6bdc8d393c1ad8ad92efd7f3ec654373a56b4fe 100644 (file)
@@ -249,9 +249,17 @@ CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len){
                /* Skip first 4 characters if they are "\??\" */
                if(target[0] == '\\' && target[1] == '\\' && target[2] == '?' && target[3] ==  '\\') {
                        char tmp[MAXPATHLEN];
-
+                       unsigned int offset = 4;
                        dwRet -= 4;
-                       memcpy(tmp, target + 4, dwRet);
+
+                       /* \??\UNC\ */
+                       if (dwRet > 7 && target[4] == 'U' && target[5] == 'N' && target[6] == 'C') {
+                               offset += 2;
+                               dwRet -= 2;
+                               target[offset] = '\\';
+                       }
+
+                       memcpy(tmp, target + offset, dwRet);
                        memcpy(target, tmp, dwRet);
                }
        }