Skip to content

Commit ef7229e

Browse files
committed
- Fix #55295, check if malloc failed
1 parent fa7c07b commit ef7229e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

TSRM/tsrm_win32.c

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

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

0 commit comments

Comments
 (0)