Fixed environment when no newline was present.
[nssm.git] / gui.cpp
diff --git a/gui.cpp b/gui.cpp
index 2642ad1..f9a553d 100644 (file)
--- a/gui.cpp
+++ b/gui.cpp
@@ -157,7 +157,7 @@ int install(HWND window) {
       unsigned long i, j;\r
       for (i = 0; i < envlen; i++) if (env[i] != '\r') newlen++;\r
       /* Must end with two NULLs. */\r
-      newlen++;\r
+      newlen += 2;\r
 \r
       char *newenv = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, newlen);\r
       if (! newenv) {\r