diff options
author | Remi Collet <remi@php.net> | 2013-12-30 07:35:30 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2013-12-30 07:35:30 +0100 |
commit | 0a950a05005f94e56bd2a42b99a0961db86952db (patch) | |
tree | 3949553a3f889947795b007df4776643b153da55 /ext/zip/lib/zip_source_filep.c | |
parent | 5a756afcf14fada75f6ed8052cd97924dd229ed8 (diff) | |
download | php-git-0a950a05005f94e56bd2a42b99a0961db86952db.tar.gz |
Sync with pecl/zip 1.12.4dev
- update bunled libzip to 0.11.2
- expose zip_file_set_external_attributes + zip_file_get_external_attributes
with new methods:
ZipArchive::setExternalAttributesName
ZipArchive::setExternalAttributesIndex
ZipArchive::getExternalAttributesName
ZipArchive::getExternalAttributesIndex
Diffstat (limited to 'ext/zip/lib/zip_source_filep.c')
-rw-r--r-- | ext/zip/lib/zip_source_filep.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/zip/lib/zip_source_filep.c b/ext/zip/lib/zip_source_filep.c index 0bd2d6846e..fcebe73bc6 100644 --- a/ext/zip/lib/zip_source_filep.c +++ b/ext/zip/lib/zip_source_filep.c @@ -125,7 +125,8 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) { struct read_file *z; char *buf; - size_t i, n; + zip_uint64_t n; + size_t i; z = (struct read_file *)state; buf = (char *)data; @@ -151,11 +152,13 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) return 0; case ZIP_SOURCE_READ: - /* XXX: return INVAL if len > size_t max */ if (z->remain != -1) n = len > (zip_uint64_t)z->remain ? (zip_uint64_t)z->remain : len; else n = len; + + if (n > SIZE_MAX) + n = SIZE_MAX; if (!z->closep) { /* we might share this file with others, so let's be safe */ @@ -166,7 +169,7 @@ read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) } } - if ((i=fread(buf, 1, n, z->f)) == 0) { + if ((i=fread(buf, 1, (size_t)n, z->f)) == 0) { if (ferror(z->f)) { z->e[0] = ZIP_ER_READ; z->e[1] = errno; |