com php-src: Fix bug #71923 - integer overflow in ZipArchive::getFrom*: ext/zip/php_zip.c
| From: | Stanislav Malyshev | Date: | Wed, 27 Apr 2016 05:59:09 +0000 |
| Subject: | com php-src: Fix bug #71923 - integer overflow in ZipArchive::getFrom*: ext/zip/php_zip.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91855@lists.php.net to get a copy of this message | ||
Commit: ccc12efa32f855e6057cb9b7e1e45afe08503a00
Author: Stanislav Malyshev <stas@php.net> Tue, 19 Apr 2016 23:49:22 -0700
Parents: c89b7a48606468107adb4a83d5d39bfc6cda1d5f
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ccc12efa32f855e6057cb9b7e1e45afe08503a00
Log:
Fix bug #71923 - integer overflow in ZipArchive::getFrom*
Bugs:
https://bugs.php.net/71923
Changed paths:
M ext/zip/php_zip.c
Diff:
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index db201af..7c9adf4 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
RETURN_FALSE;
}
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n < 1) {
zend_string_free(buffer);