summaryrefslogtreecommitdiff
path: root/ext/standard/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/exec.c')
-rw-r--r--ext/standard/exec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 7f8ce817e4..0591dcf4e0 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -537,6 +537,15 @@ PHP_FUNCTION(shell_exec)
Z_PARAM_STRING(command, command_len)
ZEND_PARSE_PARAMETERS_END();
+ if (!command_len) {
+ php_error_docref(NULL, E_WARNING, "Cannot execute a blank command");
+ RETURN_FALSE;
+ }
+ if (strlen(command) != command_len) {
+ php_error_docref(NULL, E_WARNING, "NULL byte detected. Possible attack");
+ RETURN_FALSE;
+ }
+
#ifdef PHP_WIN32
if ((in=VCWD_POPEN(command, "rt"))==NULL) {
#else