Skip to content

Commit 864d69b

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

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
@@ -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

ext/standard/url.c

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

0 commit comments

Comments
 (0)