com php-src: Patch for Heap Buffer Overflow in EscapeShell: ext/standard/exec.c
| From: | Anatol Belski | Date: | Wed, 06 Jan 2016 06:49:21 +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-90552@lists.php.net to get a copy of this message | ||
Commit: 2871c70efaaaa0f102557a17c727fd4d5204dd4b
Author: libnex <emmanuel.law@gmail.com> Mon, 4 Jan 2016 12:27:27 +1300
Committer: Anatol Belski <ab@php.net> Wed, 6 Jan 2016 07:49:21 +0100
Parents: e2565eb614e3c8b938c1dc50a0bd6470fab64921
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2871c70efaaaa0f102557a17c727fd4d5204dd4b
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 c724b79..c4afce3 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++] = '"';