|
|
af9dc8 |
From 40ef6e07e0b2cdced57c506e08cf18f47122292d Mon Sep 17 00:00:00 2001
|
|
|
af9dc8 |
From: Remi Collet <remi@php.net>
|
|
|
af9dc8 |
Date: Tue, 10 Jun 2014 14:22:04 +0200
|
|
|
af9dc8 |
Subject: [PATCH] Bug #67412 fileinfo: cdf_count_chain insufficient
|
|
|
af9dc8 |
boundary check
|
|
|
af9dc8 |
|
|
|
af9dc8 |
Upstream:
|
|
|
af9dc8 |
https://github.com/file/file/commit/40bade80cbe2af1d0b2cd0420cebd5d5905a2382
|
|
|
af9dc8 |
---
|
|
|
af9dc8 |
ext/fileinfo/libmagic/cdf.c | 7 ++++---
|
|
|
af9dc8 |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
af9dc8 |
|
|
|
af9dc8 |
diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c
|
|
|
af9dc8 |
index c9a5d50..ee467a6 100644
|
|
|
af9dc8 |
--- a/ext/fileinfo/libmagic/cdf.c
|
|
|
af9dc8 |
+++ b/ext/fileinfo/libmagic/cdf.c
|
|
|
af9dc8 |
@@ -470,7 +470,8 @@ size_t
|
|
|
af9dc8 |
cdf_count_chain(const cdf_sat_t *sat, cdf_secid_t sid, size_t size)
|
|
|
af9dc8 |
{
|
|
|
af9dc8 |
size_t i, j;
|
|
|
af9dc8 |
- cdf_secid_t maxsector = (cdf_secid_t)(sat->sat_len * size);
|
|
|
af9dc8 |
+ cdf_secid_t maxsector = (cdf_secid_t)((sat->sat_len * size)
|
|
|
af9dc8 |
+ / sizeof(maxsector));
|
|
|
af9dc8 |
|
|
|
af9dc8 |
DPRINTF(("Chain:"));
|
|
|
af9dc8 |
for (j = i = 0; sid >= 0; i++, j++) {
|
|
|
af9dc8 |
@@ -480,8 +481,8 @@ cdf_count_chain(const cdf_sat_t *sat, cdf_secid_t sid, size_t size)
|
|
|
af9dc8 |
errno = EFTYPE;
|
|
|
af9dc8 |
return (size_t)-1;
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
- if (sid > maxsector) {
|
|
|
af9dc8 |
- DPRINTF(("Sector %d > %d\n", sid, maxsector));
|
|
|
af9dc8 |
+ if (sid >= maxsector) {
|
|
|
af9dc8 |
+ DPRINTF(("Sector %d >= %d\n", sid, maxsector));
|
|
|
af9dc8 |
errno = EFTYPE;
|
|
|
af9dc8 |
return (size_t)-1;
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
--
|
|
|
af9dc8 |
1.9.2
|
|
|
af9dc8 |
|