Skip to content

Commit d3fbdf0

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix bug #79465 - use unsigneds as indexes. Fix bug #79330 - make all execution modes consistent in rejecting \0
2 parents 8300458 + 864d69b commit d3fbdf0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

ext/standard/exec.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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

ext/standard/url.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)