aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-01-11 12:42:35 +0000
committerCorinna Vinschen <corinna@vinschen.de>2005-01-11 12:42:35 +0000
commitd1ce9364f33654b87fa9bca7e096fd253f85d078 (patch)
treeb71bc33126f9899d7d08157960f89a9f25697d5f /winsup
parent58bdcd7fc7cf3be2f9c7805b2afd95807d23b0a9 (diff)
downloadnewlib-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')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/environ.cc8
2 files changed, 13 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1192a06..dea1593 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2005-01-11 Corinna Vinschen <corinna@vinschen.de>
+
+ * environ.cc (build_env): Disallow empty strings and strings starting
+ with '=' in Win32 environment.
+
2005-01-08 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (seteuid32): Only change the default dacl when
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)