008-cve-2014-9913-unzip-buffer-overflow.patch (1336B)
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 @@ int list_files(__G) /* return PK-type 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? */