Don't try to ansify the path if it is empty
authorSteve Hay <steve.m.hay@googlemail.com>
Fri, 16 Nov 2012 09:11:36 +0000 (09:11 +0000)
committerSteve Hay <steve.m.hay@googlemail.com>
Fri, 16 Nov 2012 14:14:08 +0000 (14:14 +0000)
Fixes a possible crash (manifested when running with the page heap enabled)
when running after clearing PATH, which at least one test in op/taint.t
does.

win32/win32.c

index 5d6946a..cc2f095 100644 (file)
@@ -4242,6 +4242,8 @@ ansify_path(void)
     wide_path = (WCHAR*)win32_malloc(len*sizeof(WCHAR));
     while (wide_path) {
         size_t newlen = GetEnvironmentVariableW(L"PATH", wide_path, len);
+        if (newlen == 0)
+            return;
         if (newlen < len)
             break;
         len = newlen;