Explorar o código

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 %!s(int64=10) %!d(string=hai) anos
pai
achega
e72db63c5e
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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) {