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)
529
529
Z_PARAM_STRING (command , command_len )
530
530
ZEND_PARSE_PARAMETERS_END ();
531
531
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
+
532
541
#ifdef PHP_WIN32
533
542
if ((in = VCWD_POPEN (command , "rt" ))== NULL ) {
534
543
#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)
545
545
#ifndef CHARSET_EBCDIC
546
546
* dest = (char ) php_htoi (data + 1 );
547
547
#else
548
- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
548
+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
549
549
#endif
550
550
data += 2 ;
551
551
len -= 2 ;
@@ -641,7 +641,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
641
641
#ifndef CHARSET_EBCDIC
642
642
* dest = (char ) php_htoi (data + 1 );
643
643
#else
644
- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
644
+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
645
645
#endif
646
646
data += 2 ;
647
647
len -= 2 ;
You can’t perform that action at this time.
0 commit comments