com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/standard/exec.c

From: Date: Fri, 04 Nov 2016 05:05:25 +0000
Subject: com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/standard/exec.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95391@lists.php.net to get a copy of this message
Commit: 2fa455128c7f6c42eb00a43f8bb28a395af4aeda Author: Stanislav Malyshev <stas@php.net> Thu, 3 Nov 2016 22:05:25 -0700 Parents: 6e12e49b5be06b4346e3d7802ea9b09f9f1abd7b 1fd18821e08c72e026de30ab915b73ec32dcf0ad Branches: PHP-7.0 PHP-7.1 master Link: http://git.php..net/?p=php-src.git;a=commitdiff;h=2fa455128c7f6c42eb00a43f8bb28a395af4aeda Log: Merge branch 'PHP-5.6' into PHP-7.0 * PHP-5.6: More string length checks & fixes Changed paths: MM ext/standard/exec.c Diff: diff --cc ext/standard/exec.c index 7bd3ef9,88a6b4a..7e21bce --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@@ -479,10 -488,11 +479,11 @@@ PHP_FUNCTION(escapeshellcmd if (command_len) { if (command_len != strlen(command)) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Input string contains NULL bytes"); + php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes"); return; } - RETVAL_STR(php_escape_shell_cmd(command)); + cmd = php_escape_shell_cmd(command); + RETVAL_STRINGL_CHECK(cmd, strlen(cmd), 0); } else { RETVAL_EMPTY_STRING(); } @@@ -502,10 -513,11 +503,11 @@@ PHP_FUNCTION(escapeshellarg if (argument) { if (argument_len != strlen(argument)) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Input string contains NULL bytes"); + php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes"); return; } - RETVAL_STR(php_escape_shell_arg(argument)); + cmd = php_escape_shell_arg(argument); + RETVAL_STRINGL_CHECK(cmd, strlen(cmd), 0); } } /* }}} */ @@@ -534,11 -547,11 +536,11 @@@ PHP_FUNCTION(shell_exec } stream = php_stream_fopen_from_pipe(in, "rb"); - total_readbytes = php_stream_copy_to_mem(stream, &ret, PHP_STREAM_COPY_ALL, 0); + ret = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0); php_stream_close(stream); - if (ret && ZSTR_LEN(ret) > 0) { - RETVAL_STR(ret); + if (total_readbytes > 0) { + RETVAL_STRINGL_CHECK(ret, total_readbytes, 0); } } /* }}} */

« previous php.cvs (#95391) next »