]> sourceware.org Git - newlib-cygwin.git/commitdiff
* environ.cc (build_env): Disallow empty strings and strings starting
authorCorinna Vinschen <corinna@vinschen.de>
Tue, 11 Jan 2005 12:42:35 +0000 (12:42 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 11 Jan 2005 12:42:35 +0000 (12:42 +0000)
with '=' in Win32 environment.

winsup/cygwin/ChangeLog
winsup/cygwin/environ.cc

index 1192a06f4474fcee5ff470a466a6610e808f0f85..dea1593f3a437aad60b004e066f90a0147b78924 100644 (file)
@@ -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
index 4b15df253187d9ccbb3dd83b606a14e35d78e3a7..8605cf2e69e0b1bc1523a56fb565e3cc50ecc495 100644 (file)
@@ -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)
This page took 0.038971 seconds and 5 git commands to generate.