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 @@ -537,6 +537,15 @@ PHP_FUNCTION(shell_exec)
537537 Z_PARAM_STRING (command , command_len )
538538 ZEND_PARSE_PARAMETERS_END ();
539539
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+
540549#ifdef PHP_WIN32
541550 if ((in = VCWD_POPEN (command , "rt" ))== NULL ) {
542551#else
Original file line number Diff line number Diff line change @@ -543,7 +543,7 @@ PHPAPI size_t php_url_decode(char *str, size_t len)
543543#ifndef CHARSET_EBCDIC
544544 * dest = (char ) php_htoi (data + 1 );
545545#else
546- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
546+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
547547#endif
548548 data += 2 ;
549549 len -= 2 ;
@@ -639,7 +639,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
639639#ifndef CHARSET_EBCDIC
640640 * dest = (char ) php_htoi (data + 1 );
641641#else
642- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
642+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
643643#endif
644644 data += 2 ;
645645 len -= 2 ;
You can’t perform that action at this time.
0 commit comments