diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | win32/win32.c | 6 |
2 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Thu Jan 27 18:19:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> + + * win32/win32.c (wstati64): get rid of too huge alloca(). + [Bug #4316] [ruby-core:34834] + Thu Jan 27 15:11:52 2011 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): get rid of too huge diff --git a/win32/win32.c b/win32/win32.c index 67c7ce2461..f2bffa6481 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4181,13 +4181,14 @@ wstati64(const WCHAR *path, struct stati64 *st) WCHAR *buf1, *s, *end; int len, size; int ret; + VALUE v; if (!path || !st) { errno = EFAULT; return -1; } size = lstrlenW(path) + 2; - buf1 = ALLOCA_N(WCHAR, size); + buf1 = ALLOCV_N(WCHAR, v, size); for (p = path, s = buf1; *p; p++, s++) { if (*p == L'/') *s = L'\\'; @@ -4215,6 +4216,9 @@ wstati64(const WCHAR *path, struct stati64 *st) if (ret == 0) { st->st_mode &= ~(S_IWGRP | S_IWOTH); } + if (v) + ALLOCV_END(v); + return ret; } |