Skip to content

Commit 14fcc81

Browse files
committed
Fix bug #79330 - make all execution modes consistent in rejecting \0
1 parent 3072b77 commit 14fcc81

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/standard/exec.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,15 @@ PHP_FUNCTION(shell_exec)
531531
Z_PARAM_STRING(command, command_len)
532532
ZEND_PARSE_PARAMETERS_END();
533533

534+
if (!command_len) {
535+
php_error_docref(NULL, E_WARNING, "Cannot execute a blank command");
536+
RETURN_FALSE;
537+
}
538+
if (strlen(command) != command_len) {
539+
php_error_docref(NULL, E_WARNING, "NULL byte detected. Possible attack");
540+
RETURN_FALSE;
541+
}
542+
534543
#ifdef PHP_WIN32
535544
if ((in=VCWD_POPEN(command, "rt"))==NULL) {
536545
#else

0 commit comments

Comments
 (0)