com php-src: Patch for Heap Buffer Overflow in EscapeShell: ext/standard/exec.c
| From: | Anatol Belski | Date: | Wed, 06 Jan 2016 05:33:04 +0000 |
| Subject: | com php-src: Patch for Heap Buffer Overflow in EscapeShell: ext/standard/exec.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90554@lists.php.net to get a copy of this message | ||
Commit: c666a67a9873707a6cd9c83bbd09c3ac1b76e0d2
Author: libnex <emmanuel.law@gmail.com> Mon, 4 Jan 2016 12:27:27 +1300
Committer: Anatol Belski <ab@php.net> Wed, 6 Jan 2016 06:33:04 +0100
Parents: bf76af30c7c8c5c225cd2ff8af0caedd97354d9e
Branches: PHP-7.0.2
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c666a67a9873707a6cd9c83bbd09c3ac1b76e0d2
Log:
Patch for Heap Buffer Overflow in EscapeShell
Proposed patch for bug #71270
Bugs:
https://bugs.php.net/71270
Changed paths:
M ext/standard/exec.c
Diff:
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 8dd0d5d..e330da3 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -253,7 +253,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
#endif
- cmd = zend_string_alloc(2 * l, 0);
+ cmd = zend_string_safe_alloc(2, l, 0, 0);
for (x = 0, y = 0; x < l; x++) {
int mb_len = php_mblen(str + x, (l - x));
@@ -345,7 +345,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str)
size_t estimate = (4 * l) + 3;
- cmd = zend_string_alloc(4 * l + 2, 0); /* worst case */
+ cmd = zend_string_safe_alloc(4, l, 2, 0); /* worst case */
#ifdef PHP_WIN32
ZSTR_VAL(cmd)[y++] = '"';