From: Pierre Joye Date: Wed, 27 Jul 2011 14:23:06 +0000 (+0000) Subject: - Fix #55295, check if malloc failed X-Git-Tag: php-5.4.0alpha3~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ef7229ed177abf629b7106a6adaf9e80147f438f;p=php - Fix #55295, check if malloc failed --- diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 6031cc29da..d49506636f 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -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);