diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-01-11 12:42:35 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-01-11 12:42:35 +0000 |
commit | d1ce9364f33654b87fa9bca7e096fd253f85d078 (patch) | |
tree | b71bc33126f9899d7d08157960f89a9f25697d5f /winsup/cygwin/environ.cc | |
parent | 58bdcd7fc7cf3be2f9c7805b2afd95807d23b0a9 (diff) | |
download | newlib-d1ce9364f33654b87fa9bca7e096fd253f85d078.zip newlib-d1ce9364f33654b87fa9bca7e096fd253f85d078.tar.gz newlib-d1ce9364f33654b87fa9bca7e096fd253f85d078.tar.bz2 |
* environ.cc (build_env): Disallow empty strings and strings starting
with '=' in Win32 environment.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r-- | winsup/cygwin/environ.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 4b15df2..8605cf2 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -957,6 +957,14 @@ build_env (const char * const *envp, char *&envblock, int &envc, win_env *conv; len = strcspn (*srcp, "=") + 1; + /* Check for a bad entry. This is necessary to get rid of empty + strings, induced by putenv and changing the string afterwards. + Note that this doesn't stop invalid strings without '=' in it + etc., but we're opting for speed here for now. Adding complete + checking would be pretty expensive. */ + if (len == 1) + continue; + /* See if this entry requires posix->win32 conversion. */ conv = getwinenv (*srcp, *srcp + len); if (conv) |