diff options
author | Remi Collet <remi@php.net> | 2014-06-10 14:22:04 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2014-06-10 14:22:04 +0200 |
commit | 40ef6e07e0b2cdced57c506e08cf18f47122292d (patch) | |
tree | afaabc75f30523930f49fb1df896392ed3172080 | |
parent | 2b33a41162a729b3b680fa2015efe11f15cc3114 (diff) | |
download | php-git-40ef6e07e0b2cdced57c506e08cf18f47122292d.tar.gz |
Bug #67412 fileinfo: cdf_count_chain insufficient boundary check
Upstream:
https://github.com/file/file/commit/40bade80cbe2af1d0b2cd0420cebd5d5905a2382
-rw-r--r-- | ext/fileinfo/libmagic/cdf.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c index c9a5d50a35..ee467a6671 100644 --- a/ext/fileinfo/libmagic/cdf.c +++ b/ext/fileinfo/libmagic/cdf.c @@ -470,7 +470,8 @@ size_t cdf_count_chain(const cdf_sat_t *sat, cdf_secid_t sid, size_t size) { size_t i, j; - cdf_secid_t maxsector = (cdf_secid_t)(sat->sat_len * size); + cdf_secid_t maxsector = (cdf_secid_t)((sat->sat_len * size) + / sizeof(maxsector)); DPRINTF(("Chain:")); for (j = i = 0; sid >= 0; i++, j++) { @@ -480,8 +481,8 @@ cdf_count_chain(const cdf_sat_t *sat, cdf_secid_t sid, size_t size) errno = EFTYPE; return (size_t)-1; } - if (sid > maxsector) { - DPRINTF(("Sector %d > %d\n", sid, maxsector)); + if (sid >= maxsector) { + DPRINTF(("Sector %d >= %d\n", sid, maxsector)); errno = EFTYPE; return (size_t)-1; } |