Blame SOURCES/file-5.11-CVE-2014-0207.patch

0233e9
From 4fcb9a9d1b1063a65fbeb27395de4979c75bd962 Mon Sep 17 00:00:00 2001
0233e9
From: Remi Collet <remi@php.net>
0233e9
Date: Tue, 3 Jun 2014 11:05:00 +0200
0233e9
Subject: [PATCH] Fix bug #67326	fileinfo: cdf_read_short_sector insufficient
0233e9
 boundary check
0233e9
0233e9
Upstream fix https://github.com/file/file/commit/6d209c1c489457397a5763bca4b28e43aac90391.patch
0233e9
Only revelant part applied
0233e9
---
0233e9
 ext/fileinfo/libmagic/cdf.c | 4 ++--
0233e9
 1 file changed, 2 insertions(+), 2 deletions(-)
0233e9
0233e9
diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c
0233e9
index 4712e84..16649f1 100644
0233e9
--- a/src/cdf.c
0233e9
+++ b/src/cdf.c
83d9a8
@@ -352,10 +352,10 @@ cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs,
0233e9
 	size_t ss = CDF_SHORT_SEC_SIZE(h);
0233e9
 	size_t pos = CDF_SHORT_SEC_POS(h, id);
0233e9
 	assert(ss == len);
0233e9
-	if (pos > CDF_SEC_SIZE(h) * sst->sst_len) {
0233e9
+	if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) {
0233e9
 		DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
0233e9
 		    SIZE_T_FORMAT "u\n",
0233e9
-		    pos, CDF_SEC_SIZE(h) * sst->sst_len));
0233e9
+		    pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
0233e9
 		return -1;
0233e9
 	}
0233e9
 	(void)memcpy(((char *)buf) + offs,
0233e9
-- 
0233e9
1.9.2
0233e9