]> granicus.if.org Git - php/commitdiff
- Fix off by one error in allocating command line (by Shane)
authorAndi Gutmans <andi@php.net>
Sat, 7 Jul 2001 20:00:35 +0000 (20:00 +0000)
committerAndi Gutmans <andi@php.net>
Sat, 7 Jul 2001 20:00:35 +0000 (20:00 +0000)
TSRM/tsrm_win32.c

index 47c91d381e51c1edcdb97ce3049275f1307b7a0c..daa861bf03ecc4e0244164212abf8b958b406b1d 100644 (file)
@@ -135,7 +135,7 @@ TSRM_API FILE* popen(const char *command, const char *type)
                startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
        }
 
-       cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+4);
+       cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c "));
        sprintf(cmd, "%s /c %s", TWG(comspec), command);
        if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, NULL, NULL, &startup, &process)) {
                return NULL;
@@ -184,4 +184,4 @@ TSRM_API int pclose(FILE* stream)
        return termstat;
 }
 
-#endif
\ No newline at end of file
+#endif