]> granicus.if.org Git - php/commitdiff
- Fix #55295, check if malloc failed
authorPierre Joye <pajoye@php.net>
Wed, 27 Jul 2011 14:23:06 +0000 (14:23 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 27 Jul 2011 14:23:06 +0000 (14:23 +0000)
TSRM/tsrm_win32.c

index 6031cc29da14fa8d72d65efacd24057f237d4df1..d49506636f454d2edd2362b6cab5fd0b894d35af 100644 (file)
@@ -530,6 +530,10 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
        }
 
        cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2);
+       if (!cmd) {
+               return NULL;
+       }
+
        sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);
        if (asuser) {
                res = CreateProcessAsUser(token_user, NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process);