* environ.cc (build_env): Disallow empty strings and strings starting

with '=' in Win32 environment.
This commit is contained in:
Corinna Vinschen 2005-01-11 12:42:35 +00:00
parent 58bdcd7fc7
commit d1ce9364f3
2 changed files with 13 additions and 0 deletions

View 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

View 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)