com php-src: Merge branch 'PHP-5.6': ext/standard/exec.c
| From: | Yasuo Ohgaki | Date: | Fri, 13 Feb 2015 20:28:32 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6': ext/standard/exec.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84874@lists.php.net to get a copy of this message | ||
Commit: 096fb06dab980a68b2eaae0b9e516faffe8579f9
Author: Yasuo Ohgaki <yohgaki@php.net> Sat, 14 Feb 2015 05:28:32 +0900
Parents: bfeae649f632826c5d8a8fade1a63d00ee588ff5 a54300b3f69aa1c0f417d02d653045f8805f327d
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=096fb06dab980a68b2eaae0b9e516faffe8579f9
Log:
Merge branch 'PHP-5.6'
* PHP-5.6:
Add NULL byte protection to exec, system and passthru
Changed paths:
MM ext/standard/exec.c
Diff:
diff --cc ext/standard/exec.c
index 132d1af,6838788..a727573
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@@ -186,12 -185,16 +186,16 @@@ static void php_exec_ex(INTERNAL_FUNCTI
}
}
if (!cmd_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot execute a blank command");
+ php_error_docref(NULL, E_WARNING, "Cannot execute a blank command");
RETURN_FALSE;
}
+ if (strlen(cmd) != cmd_len) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "NULL byte detected. Possible attack");
+ RETURN_FALSE;
+ }
if (!ret_array) {
- ret = php_exec(mode, cmd, NULL, return_value TSRMLS_CC);
+ ret = php_exec(mode, cmd, NULL, return_value);
} else {
if (Z_TYPE_P(ret_array) != IS_ARRAY) {
zval_dtor(ret_array);