diff options
author | Pierre Joye <pajoye@php.net> | 2010-09-10 19:21:02 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2010-09-10 19:21:02 +0000 |
commit | e0591d0ea1eb0279bf51e25d8d92083d892fa94b (patch) | |
tree | 677dcc7019f6453a7631301c76e29f2a76c245bf | |
parent | 4d8d26d0db5f8e0e8a0effb827dce13075cf6454 (diff) | |
download | php-git-e0591d0ea1eb0279bf51e25d8d92083d892fa94b.tar.gz |
- remove 'UNC' from the target
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 1f115f6646..a6bdc8d393 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -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); } } |