summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-27 09:21:40 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-27 09:21:40 +0000
commit21931d6aa2fb5dc0b2d058323cba33bc5772653e (patch)
treefb60d7ca1e350ae84ef83f7fa01578220f44a667 /win32
parent11c5daa698d5a6ba4003d941fb64c765b7f99c42 (diff)
* win32/win32.c (wstati64): get rid of too huge alloca().
[Bug #4316] [ruby-core:34834] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c6
1 files changed, 5 insertions, 1 deletions
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;
}