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 @@ -547,7 +547,7 @@ PHPAPI size_t php_url_decode(char *str, size_t len)
547
547
#ifndef CHARSET_EBCDIC
548
548
* dest = (char ) php_htoi (data + 1 );
549
549
#else
550
- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
550
+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
551
551
#endif
552
552
data += 2 ;
553
553
len -= 2 ;
@@ -643,7 +643,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
643
643
#ifndef CHARSET_EBCDIC
644
644
* dest = (char ) php_htoi (data + 1 );
645
645
#else
646
- * dest = os_toebcdic [(char ) php_htoi (data + 1 )];
646
+ * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
647
647
#endif
648
648
data += 2 ;
649
649
len -= 2 ;
You can’t perform that action at this time.
0 commit comments