summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c7
1 files changed, 6 insertions, 1 deletions
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 {