Mercurial > vanilla
comparison compression/unzip/CVE-2014-9913.patch @ 452:8c4366128400
compression/unzip: initial import, closes #1553
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 06 Apr 2019 08:13:23 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
451:bcfdaa03daa2 | 452:8c4366128400 |
---|---|
1 From: "Steven M. Schweda" <sms@antinode.info> | |
2 Subject: Fix CVE-2014-9913, buffer overflow in unzip | |
3 Bug: https://sourceforge.net/p/infozip/bugs/27/ | |
4 Bug-Debian: https://bugs.debian.org/847485 | |
5 Bug-Ubuntu: https://launchpad.net/bugs/387350 | |
6 X-Debian-version: 6.0-21 | |
7 | |
8 --- a/list.c | |
9 +++ b/list.c | |
10 @@ -339,7 +339,18 @@ | |
11 G.crec.compression_method == ENHDEFLATED) { | |
12 methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3]; | |
13 } else if (methnum >= NUM_METHODS) { | |
14 - sprintf(&methbuf[4], "%03u", G.crec.compression_method); | |
15 + /* 2013-02-26 SMS. | |
16 + * http://sourceforge.net/p/infozip/bugs/27/ CVE-2014-9913. | |
17 + * Unexpectedly large compression methods overflow | |
18 + * &methbuf[]. Use the old, three-digit decimal format | |
19 + * for values which fit. Otherwise, sacrifice the | |
20 + * colon, and use four-digit hexadecimal. | |
21 + */ | |
22 + if (G.crec.compression_method <= 999) { | |
23 + sprintf( &methbuf[ 4], "%03u", G.crec.compression_method); | |
24 + } else { | |
25 + sprintf( &methbuf[ 3], "%04X", G.crec.compression_method); | |
26 + } | |
27 } | |
28 | |
29 #if 0 /* GRR/Euro: add this? */ |