File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ PHP NEWS
35
35
(cmb)
36
36
37
37
- Standard:
38
+ . Fixed bug #79330 (shell_exec() silently truncates after a null byte). (stas)
38
39
. Fixed bug #79410 (system() swallows last chunk if it is exactly 4095 bytes
39
40
without newline). (Christian Schneider)
40
41
Original file line number Diff line number Diff line change @@ -537,6 +537,15 @@ PHP_FUNCTION(shell_exec)
537
537
Z_PARAM_STRING (command , command_len )
538
538
ZEND_PARSE_PARAMETERS_END ();
539
539
540
+ if (!command_len ) {
541
+ php_error_docref (NULL , E_WARNING , "Cannot execute a blank command" );
542
+ RETURN_FALSE ;
543
+ }
544
+ if (strlen (command ) != command_len ) {
545
+ php_error_docref (NULL , E_WARNING , "NULL byte detected. Possible attack" );
546
+ RETURN_FALSE ;
547
+ }
548
+
540
549
#ifdef PHP_WIN32
541
550
if ((in = VCWD_POPEN (command , "rt" ))== NULL ) {
542
551
#else
You can’t perform that action at this time.
0 commit comments