Patch based on http://seclists.org/oss-sec/2016/q4/600
The community plans to fix this security vulnerability in a future
release, so we will not pass this patch to the community.
--- unzip60/zipinfo.c 2017-01-12 01:09:21.487547363 -0800
+++ unzip60/zipinfo.c.new 2017-01-12 01:13:38.476562067 -0800
@@ -1987,7 +1987,18 @@
ush dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3);
methbuf[3] = dtype[dnum];
} else if (methnum >= NUM_METHODS) { /* unknown */
- sprintf(&methbuf[1], "%03u", G.crec.compression_method);
+ /* 2016-12-05 SMS.
+ * https://launchpad.net/bugs/1643750
+ * Unexpectedly large compression methods overflow
+ * &methbuf[]. Use the old, three-digit decimal format
+ * for values which fit. Otherwise, sacrifice the "u",
+ * and use four-digit hexadecimal.
+ */
+ if (G.crec.compression_method <= 999) {
+ sprintf(&methbuf[1], "%03u", G.crec.compression_method);
+ } else {
+ sprintf(&methbuf[0], "%04X", G.crec.compression_method);
+ }
}
for (k = 0; k < 15; ++k)