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

0233e9
From 1803228597e82218a8c105e67975bc50e6f5bf0d Mon Sep 17 00:00:00 2001
0233e9
From: Remi Collet <remi@php.net>
0233e9
Date: Wed, 22 Oct 2014 15:37:04 +0200
0233e9
Subject: [PATCH] Fix bug #68283: fileinfo: out-of-bounds read in elf note
0233e9
 headers
0233e9
0233e9
Upstream commit
0233e9
https://github.com/file/file/commit/39c7ac1106be844a5296d3eb5971946cc09ffda0
0233e9
0233e9
CVE -2014-3710
0233e9
---
0233e9
 ext/fileinfo/libmagic/readelf.c | 7 +++++++
0233e9
 1 file changed, 7 insertions(+)
0233e9
0233e9
diff --git a/ext/fileinfo/libmagic/readelf.c b/ext/fileinfo/libmagic/readelf.c
0233e9
index 1c3845f..bb6f70f 100644
0233e9
--- a/src/readelf.c
0233e9
+++ b/src/readelf.c
83d9a8
@@ -366,6 +366,13 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
0233e9
 	uint32_t namesz, descsz;
0233e9
 	unsigned char *nbuf = CAST(unsigned char *, vbuf);
0233e9
 
0233e9
+	if (xnh_sizeof + offset > size) {
0233e9
+		/*
0233e9
+		 * We're out of note headers.
0233e9
+		 */
0233e9
+		return xnh_sizeof + offset;
0233e9
+	}
0233e9
+
0233e9
 	(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
0233e9
 	offset += xnh_sizeof;
0233e9
 
0233e9
-- 
0233e9
2.1.0
0233e9