diff options
author | Anatol Belski <ab@php.net> | 2016-08-29 17:25:46 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-08-29 17:25:46 +0200 |
commit | 201f90a8ccd5d4578f3200781341dc3b781c36f2 (patch) | |
tree | 08c177356e8d561661a67e1c29bfae9f6cfbfa53 | |
parent | 7ecfb4b95447b2da3ff1fbef3a3b2a9eacd38a63 (diff) | |
download | php-git-201f90a8ccd5d4578f3200781341dc3b781c36f2.tar.gz |
add error check and fix leak
-rw-r--r-- | ext/standard/proc_open.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index e443ec64a6..95803c9bbd 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -753,9 +753,14 @@ PHP_FUNCTION(proc_open) len = (sizeof(COMSPEC_NT) + sizeof(" /c ") + tmp_len + 1); cmdw2 = (wchar_t *)malloc(len * sizeof(wchar_t)); + if (!cmdw2) { + php_error_docref(NULL, E_WARNING, "Command conversion failed"); + goto exit_fail; + } ret = _snwprintf(cmdw2, len, L"%hs /c %s", COMSPEC_NT, cmdw); if (-1 == ret) { + free(cmdw2); php_error_docref(NULL, E_WARNING, "Command conversion failed"); goto exit_fail; } |