diff --git a/ChangeLog b/ChangeLog index ee673a70c9..af066ae012 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Mar 19 17:14:46 2011 Tajima Akio + + * 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 * ext/openssl/ossl_x509revoked.c: parenthesize macro arguments. diff --git a/hash.c b/hash.c index f86152ae70..b303211db7 100644 --- a/hash.c +++ b/hash.c @@ -2206,7 +2206,12 @@ ruby_setenv(const char *name, const char *value) rb_sys_fail("ruby_setenv"); } 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); } else {