From 65942d343f75a623b4a2e235754ba181987aaee9 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Mon, 13 Sep 2010 10:58:18 +0000 Subject: [PATCH] - sanity check for the path length and don't treat UNC as local path (no functional change, only less ops) --- TSRM/tsrm_virtual_cwd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- 2.50.1