diff options
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 4b15df253..8605cf2e6 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) |