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)
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
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)
543
543
#ifndef CHARSET_EBCDIC
544
544
* dest = (char ) php_htoi (data + 1 );
545
545
#else
546
- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
546
+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
547
547
#endif
548
548
data += 2 ;
549
549
len -= 2 ;
@@ -639,7 +639,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
639
639
#ifndef CHARSET_EBCDIC
640
640
* dest = (char ) php_htoi (data + 1 );
641
641
#else
642
- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
642
+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
643
643
#endif
644
644
data += 2 ;
645
645
len -= 2 ;
You can’t perform that action at this time.
0 commit comments