Skip to content

Commit

Permalink
* win32/win32.c (wstati64): get rid of too huge alloca().
Browse files Browse the repository at this point in the history
	  [Bug ruby#4316] [ruby-core:34834]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
kosaki committed Jan 27, 2011
1 parent 11c5daa commit 21931d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Thu Jan 27 18:19:51 2011 KOSAKI Motohiro <[email protected]>

* win32/win32.c (wstati64): get rid of too huge alloca().
[Bug #4316] [ruby-core:34834]

Thu Jan 27 15:11:52 2011 NAKAMURA Usaku <[email protected]>

* win32/win32.c (rb_w32_spawn, rb_w32_aspawn): get rid of too huge
Expand Down
6 changes: 5 additions & 1 deletion win32/win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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'\\';
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 21931d6

Please sign in to comment.