summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/environ.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 45e1ca7bd..b73c710a4 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -1034,6 +1034,12 @@ build_env (const char * const *envp, char *&envblock, int &envc,
p = *srcp; /* Don't worry about it */
len = strlen (p);
+ if (len >= 32 * 1024 * 1024)
+ {
+ free (envblock);
+ envblock = NULL;
+ break;
+ }
new_tl += len + 1; /* Keep running total of block length so far */
/* See if we need to increase the size of the block. */
@@ -1066,7 +1072,6 @@ build_env (const char * const *envp, char *&envblock, int &envc,
of buffer */
}
-
debug_printf ("envp %p, envc %d", newenv, envc);
return newenv;
}