diff options
author | Christopher Faylor <me@cgf.cx> | 2005-09-16 20:12:12 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-09-16 20:12:12 +0000 |
commit | b3ecdcf438d47d78e8a6b029c209ebf6f2fea7fe (patch) | |
tree | 3eda775b8dac04c5c96e1335eb3223e13227cc75 /winsup | |
parent | e4d981b9578d322d529b65aea55964f2249b5953 (diff) | |
download | newlib-b3ecdcf438d47d78e8a6b029c209ebf6f2fea7fe.zip newlib-b3ecdcf438d47d78e8a6b029c209ebf6f2fea7fe.tar.gz newlib-b3ecdcf438d47d78e8a6b029c209ebf6f2fea7fe.tar.bz2 |
* environ.cc (build_env): Use "kilo"bytes not "mega"bytes. Return immediately
on error.
* spawn.cc (spawn_guts): Set return value to -1 on error from build_env.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/environ.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 1 |
3 files changed, 11 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 617f84a..36f1a19 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,12 @@ 2005-09-16 Christopher Faylor <cgf@timesys.com> + * environ.cc (build_env): Use "kilo"bytes not "mega"bytes. Return + immediately on error. + * spawn.cc (spawn_guts): Set return value to -1 on error from + build_env. + +2005-09-16 Christopher Faylor <cgf@timesys.com> + * environ.cc (build_env): Clear envblock and return NULL on attempt to use env var > 32K. * spawn.cc (spawn_guts): Set E2BIG if build_env detects an error. diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index b73c710..b7ca700 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -1034,11 +1034,11 @@ 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) + if (len >= 32 * 1024) { free (envblock); envblock = NULL; - break; + goto out; } new_tl += len + 1; /* Keep running total of block length so far */ @@ -1072,6 +1072,7 @@ build_env (const char * const *envp, char *&envblock, int &envc, of buffer */ } +out: debug_printf ("envp %p, envc %d", newenv, envc); return newenv; } diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 149a259..503fad1 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -627,6 +627,7 @@ spawn_guts (const char * prog_arg, const char *const *argv, if (!moreinfo->envp || !envblock) { set_errno (E2BIG); + res = -1; goto out; } ciresrv.set (chtype, real_path.iscygexec ()); |