Skip to content

Commit d539e61

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix bug #79465 - use unsigneds as indexes. Fix bug #79330 - make all execution modes consistent in rejecting \0
2 parents 7e91fcd + 9d6bf82 commit d539e61

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
@@ -547,7 +547,7 @@ PHPAPI size_t php_url_decode(char *str, size_t len)
547547
#ifndef CHARSET_EBCDIC
548548
*dest = (char) php_htoi(data + 1);
549549
#else
550-
*dest = os_toebcdic[(char) php_htoi(data + 1)];
550+
*dest = os_toebcdic[(unsigned char) php_htoi(data + 1)];
551551
#endif
552552
data += 2;
553553
len -= 2;
@@ -643,7 +643,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
643643
#ifndef CHARSET_EBCDIC
644644
*dest = (char) php_htoi(data + 1);
645645
#else
646-
*dest = os_toebcdic[(char) php_htoi(data + 1)];
646+
*dest = os_toebcdic[(unsigned char) php_htoi(data + 1)];
647647
#endif
648648
data += 2;
649649
len -= 2;

0 commit comments

Comments
 (0)