From: Pierre Joye Date: Mon, 13 Sep 2010 10:58:18 +0000 (+0000) Subject: - sanity check for the path length and don't treat UNC as local path (no functional... X-Git-Tag: php-5.3.4RC1~242 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65942d343f75a623b4a2e235754ba181987aaee9;p=php - sanity check for the path length and don't treat UNC as local path (no functional change, only less ops) --- 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);