File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -529,6 +529,15 @@ PHP_FUNCTION(shell_exec)
529529 Z_PARAM_STRING (command , command_len )
530530 ZEND_PARSE_PARAMETERS_END ();
531531
532+ if (!command_len ) {
533+ php_error_docref (NULL , E_WARNING , "Cannot execute a blank command" );
534+ RETURN_FALSE ;
535+ }
536+ if (strlen (command ) != command_len ) {
537+ php_error_docref (NULL , E_WARNING , "NULL byte detected. Possible attack" );
538+ RETURN_FALSE ;
539+ }
540+
532541#ifdef PHP_WIN32
533542 if ((in = VCWD_POPEN (command , "rt" ))== NULL ) {
534543#else
Original file line number Diff line number Diff line change @@ -545,7 +545,7 @@ PHPAPI size_t php_url_decode(char *str, size_t len)
545545#ifndef CHARSET_EBCDIC
546546 * dest = (char ) php_htoi (data + 1 );
547547#else
548- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
548+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
549549#endif
550550 data += 2 ;
551551 len -= 2 ;
@@ -641,7 +641,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
641641#ifndef CHARSET_EBCDIC
642642 * dest = (char ) php_htoi (data + 1 );
643643#else
644- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
644+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
645645#endif
646646 data += 2 ;
647647 len -= 2 ;
You can’t perform that action at this time.
0 commit comments