com php-src: Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary: ext/zip/lib/zip_dirent.c
| From: | JulienPauli | Date: | Wed, 18 Mar 2015 09:39:34 +0000 |
| Subject: | com php-src: Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary: ext/zip/lib/zip_dirent.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85610@lists.php.net to get a copy of this message | ||
Commit: 4a8d8b4154334b1714e19b82b061201d41dc87d6
Author: Stanislav Malyshev <stas@php.net> Tue, 17 Mar 2015 21:59:56 -0700
Committer: Julien Pauli <jpauli@php.net> Wed, 18 Mar 2015 10:39:34 +0100
Parents: 94e7638d9a04ebb82433147ef65e70a85d988074
Branches: PHP-5.5.23
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4a8d8b4154334b1714e19b82b061201d41dc87d6
Log:
Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary
Bugs:
https://bugs.php.net/69253
Changed paths:
M ext/zip/lib/zip_dirent.c
Diff:
diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c
index b9dac5c..0090801 100644
--- a/ext/zip/lib/zip_dirent.c
+++ b/ext/zip/lib/zip_dirent.c
@@ -101,7 +101,7 @@ _zip_cdir_new(int nentry, struct zip_error *error)
return NULL;
}
- if ((cd->entry=(struct zip_dirent *)malloc(sizeof(*(cd->entry))*nentry))
+ if ( nentry > ((size_t)-1)/sizeof(*(cd->entry)) || (cd->entry=(struct zip_dirent
*)malloc(sizeof(*(cd->entry))*(size_t)nentry))
== NULL) {
_zip_error_set(error, ZIP_ER_MEMORY, 0);
free(cd);