diff options
author | Pierre Joye <pajoye@php.net> | 2010-09-13 10:58:18 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2010-09-13 10:58:18 +0000 |
commit | 65942d343f75a623b4a2e235754ba181987aaee9 (patch) | |
tree | 37762624ce347d2154bb7e6a0144c1e2247b1956 /TSRM | |
parent | 013727e1c785071d54ffdf5eddf07a1d3ce3a5fd (diff) | |
download | php-git-65942d343f75a623b4a2e235754ba181987aaee9.tar.gz |
- sanity check for the path length and don't treat UNC as local path (no functional change, only less ops)
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 2544f005cb..02a6a4999f 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -273,17 +273,20 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{ { WIN32_FILE_ATTRIBUTE_DATA data; __int64 t; + const size_t path_len = strlen(path); if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) { return stat(path, buf); } - if (path[1] == ':') { + if (path_len >= 1 && path[1] == ':') { if (path[0] >= 'A' && path[0] <= 'Z') { buf->st_dev = buf->st_rdev = path[0] - 'A'; } else { buf->st_dev = buf->st_rdev = path[0] - 'a'; } + } else if (IS_UNC_PATH(path, path_len)) { + buf->st_dev = buf->st_rdev = 0; } else { char cur_path[MAXPATHLEN+1]; DWORD len = sizeof(cur_path); |