1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* hash.c (ruby_setenv): checking with max process environment block size fow Win32.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
arton 2011-03-19 08:10:08 +00:00
parent b86e5f8517
commit 812550b977
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Sat Mar 19 17:14:46 2011 Tajima Akio <artonx@yahoo.co.jp>
* hash.c (ruby_setenv): checking with max process environment
block size fow Win32. 32767 for 2000/XP, 2003. if failed to
read the block, then checking with 5120 for earlier Windows.
Sat Mar 19 12:30:25 2011 Tanaka Akira <akr@fsij.org> Sat Mar 19 12:30:25 2011 Tanaka Akira <akr@fsij.org>
* ext/openssl/ossl_x509revoked.c: parenthesize macro arguments. * ext/openssl/ossl_x509revoked.c: parenthesize macro arguments.

7
hash.c
View file

@ -2206,7 +2206,12 @@ ruby_setenv(const char *name, const char *value)
rb_sys_fail("ruby_setenv"); rb_sys_fail("ruby_setenv");
} }
if (value) { if (value) {
if (strlen(value) > 5120) goto fail; char* p = GetEnvironmentStringsA();
if (p) {
if (strlen(value) + strlen(p) >= 32767) goto fail;
} else {
if (strlen(value) >= 5120) goto fail;
}
buf = rb_sprintf("%s=%s", name, value); buf = rb_sprintf("%s=%s", name, value);
} }
else { else {