Преглед изворни кода

Fixed environment when no newline was present.

If the user entered environment variables without a trailing newline we
might have been left with only one trailing NULL and therefore the
environment parameter would have been invalid.  The path of least
resistance is to add two trailing NULLs unconditionally.
Iain Patterson пре 10 година
родитељ
комит
e72db63c5e
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      gui.cpp

+ 1 - 1
gui.cpp

@@ -157,7 +157,7 @@ int install(HWND window) {
       unsigned long i, j;
       for (i = 0; i < envlen; i++) if (env[i] != '\r') newlen++;
       /* Must end with two NULLs. */
-      newlen++;
+      newlen += 2;
 
       char *newenv = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, newlen);
       if (! newenv) {