com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/standard/exec.c
| From: | Stanislav Malyshev | Date: | Fri, 04 Nov 2016 05:30:46 +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-95393@lists.php.net to get a copy of this message | ||
Commit: d858b4c77fa28ff9b0a597141a58f51803bafc2b
Author: Stanislav Malyshev <stas@php.net> Thu, 3 Nov 2016 22:12:23 -0700
Parents: 2fa455128c7f6c42eb00a43f8bb28a395af4aeda 40f7fea89719da13505a521115101e74260d3fdb
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php..net/?p=php-src.git;a=commitdiff;h=d858b4c77fa28ff9b0a597141a58f51803bafc2b
Log:
Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
Add length check for bzcompress too - fix for bug #73356
Bugs:
https://bugs.php.net/73356
Changed paths:
MM ext/standard/exec.c
Diff:
diff --cc ext/standard/exec.c
index 7e21bce,88a6b4a..18480c3
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@@ -316,13 -325,13 +316,13 @@@ PHPAPI zend_string *php_escape_shell_cm
} else if (p && *p == str[x]) {
p = NULL;
} else {
- cmd[y++] = '\\';
+ ZSTR_VAL(cmd)[y++] = '\\';
}
- cmd[y++] = str[x];
+ ZSTR_VAL(cmd)[y++] = str[x];
break;
#else
- /* % is Windows specific for environmental variables, ^%PATH% will
- /* % is Windows specific for enviromental variables, ^%PATH% will
- output PATH while ^%PATH^% will not. escapeshellcmd will escape all % and !.
++ /* % is Windows specific for environmental variables, ^%PATH% will
+ output PATH while ^%PATH^% will not. escapeshellcmd->val will escape all % and !.
*/
case '%':
case '!':
@@@ -479,11 -488,11 +479,10 @@@ 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;
}
-- cmd = php_escape_shell_cmd(command);
-- RETVAL_STRINGL_CHECK(cmd, strlen(cmd), 0);
++ RETVAL_STR(php_escape_shell_cmd(command));
} else {
RETVAL_EMPTY_STRING();
}
@@@ -503,11 -513,11 +502,10 @@@ 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;
}
-- cmd = php_escape_shell_arg(argument);
-- RETVAL_STRINGL_CHECK(cmd, strlen(cmd), 0);
++ RETVAL_STR(php_escape_shell_arg(argument));
}
}
/* }}} */
@@@ -536,11 -547,11 +534,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 (total_readbytes > 0) {
-- RETVAL_STRINGL_CHECK(ret, total_readbytes, 0);
++ if (ret && ZSTR_LEN(ret) > 0) {
++ RETVAL_STR(ret);
}
}
/* }}} */