aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/rpm-CVE-2014-8118.patch
blob: 5fdb0f0eb2ad11b5b1e7330371335408fcaeb43c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Fix CVE-2014-8118 (integer overflow allowing arbitrary remote code
execution via crafted CPIO header).

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-8118

Source:
https://bugzilla.redhat.com/attachment.cgi?id=962159&action=diff

Adopted by Debian:
http://anonscm.debian.org/cgit/collab-maint/rpm.git/plain/debian/patches/CVE-2014-8118.patch

diff --git a/lib/cpio.c b/lib/cpio.c
index 253ff0f..600633a 100644
--- a/lib/cpio.c
+++ b/lib/cpio.c
@@ -399,6 +399,9 @@ int rpmcpioHeaderRead(rpmcpio_t cpio, char ** path, int * fx)
 
     GET_NUM_FIELD(hdr.filesize, fsize);
     GET_NUM_FIELD(hdr.namesize, nameSize);
+    if (nameSize <= 0 || nameSize > 4096) {
+        return RPMERR_BAD_HEADER;
+    }
 
     char name[nameSize + 1];
     read = Fread(name, nameSize, 1, cpio->fd);