diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2002-09-19 18:59:32 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2002-09-19 18:59:32 +0000 |
commit | a694fa9ca74fc05e6bb85b7313bdd51ebc29a6cd (patch) | |
tree | dd30f2bd3e0529212f9c198fd7c9c1d9fe9eba50 /ext/standard/exec.c | |
parent | 9259c4e598c4b8b3bd6b35a2bf2ac32e32143b1b (diff) | |
download | php-git-a694fa9ca74fc05e6bb85b7313bdd51ebc29a6cd.tar.gz |
Fixed bug #19313
Fixed argument count check for system/exec/passthru functions
Added a check to system/exec/passthru functions to make sure execution
parameter is not blank before attempting to execute it.
Diffstat (limited to 'ext/standard/exec.c')
-rw-r--r-- | ext/standard/exec.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c index a061266092..a855040a99 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -309,9 +309,14 @@ PHP_FUNCTION(exec) int arg_count = ZEND_NUM_ARGS(); int ret; - if (arg_count > 3 || zend_get_parameters_ex(arg_count, &arg1, &arg2, &arg3) == FAILURE) { + if (arg_count < 1 || arg_count > 3 || zend_get_parameters_ex(arg_count, &arg1, &arg2, &arg3) == FAILURE) { WRONG_PARAM_COUNT; } + + if (!Z_STRLEN_PP(arg1)) { + PHP_EMPTY_EXEC_PARAM; + } + switch (arg_count) { case 1: ret = php_Exec(0, Z_STRVAL_PP(arg1), NULL, return_value TSRMLS_CC); @@ -337,9 +342,14 @@ PHP_FUNCTION(system) int arg_count = ZEND_NUM_ARGS(); int ret; - if (arg_count > 2 || zend_get_parameters_ex(arg_count, &arg1, &arg2) == FAILURE) { + if (arg_count < 1 || arg_count > 2 || zend_get_parameters_ex(arg_count, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; } + + if (!Z_STRLEN_PP(arg1)) { + PHP_EMPTY_EXEC_PARAM; + } + switch (arg_count) { case 1: ret = php_Exec(1, Z_STRVAL_PP(arg1), NULL, return_value TSRMLS_CC); @@ -361,9 +371,14 @@ PHP_FUNCTION(passthru) int arg_count = ZEND_NUM_ARGS(); int ret; - if (arg_count > 2 || zend_get_parameters_ex(arg_count, &arg1, &arg2) == FAILURE) { + if (arg_count < 1 || arg_count > 2 || zend_get_parameters_ex(arg_count, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; } + + if (!Z_STRLEN_PP(arg1)) { + PHP_EMPTY_EXEC_PARAM; + } + switch (arg_count) { case 1: ret = php_Exec(3, Z_STRVAL_PP(arg1), NULL, return_value TSRMLS_CC); |