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 | 2beb3413746bce15f5d44d7efa439c57fcd2808d (patch) | |
tree | 5562ddb5a9502297e7b4a6b02efaa0c43e576224 /TSRM | |
parent | da4d4cef5ef569797853386da982ad2115e2bcb5 (diff) | |
download | php-git-2beb3413746bce15f5d44d7efa439c57fcd2808d.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 9f71d50151..b8292520bc 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); |