From 0a950a05005f94e56bd2a42b99a0961db86952db Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 30 Dec 2013 07:35:30 +0100 Subject: 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 --- ext/zip/lib/zip_source_filep.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ext/zip/lib/zip_source_filep.c') 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; -- cgit v1.2.1