Skip to content

Commit 0e3ec21

Browse files
committed
- Fix #55295, check if malloc failed
1 parent 94ccf70 commit 0e3ec21

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ PHP NEWS
1010
. On blocking SSL sockets respect the timeout option where possible.
1111
(Scott)
1212

13+
- Core
14+
. Fix bug #55295 [NEW]: popen_ex on windows, fixed possible heap overflow
15+
(Pierre)
16+
1317
14 Jul 2011, PHP 5.3.7 RC3
1418
- Zend Engine:
1519
. Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even

TSRM/tsrm_win32.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
532532
}
533533

534534
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2);
535+
if (!cmd) {
536+
return NULL;
537+
}
538+
535539
sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);
536540
if (asuser) {
537541
res = CreateProcessAsUser(token_user, NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process);

0 commit comments

Comments
 (0)