aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-03 13:38:27 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-03 13:38:27 +0000
commit42028bddbcc3d1807e91fbc374bc0c90c5d1e977 (patch)
treee009c07655b6e0491e3a15df0bf8b54d029c4ee3
parente094fedc2c6dcd93ebb4ef052236d002ae6ed6c9 (diff)
downloadruby-42028bddbcc3d1807e91fbc374bc0c90c5d1e977.tar.gz
win32.c: fail before getting ITEMIDLIST
* win32/win32.c (get_special_folder): fail before getting ITEMIDLIST if the buffer is less than 260 word which SHGetPathFromIDListW requires. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--win32/win32.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index c66ce614ff..18cf4f49e9 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -433,12 +433,13 @@ get_special_folder(int n, WCHAR *buf, size_t len)
func = (get_path_func)
get_proc_address("shell32", "SHGetPathFromIDListEx", NULL);
}
+ if (!func && len < 260) return FALSE;
if (SHGetSpecialFolderLocation(NULL, n, &pidl) == 0) {
if (func) {
f = func(pidl, buf, len, 0);
}
- else if (len >= 260) {
+ else {
f = SHGetPathFromIDListW(pidl, buf);
}
SHGetMalloc(&alloc);