008-cve-2014-9913-unzip-buffer-overflow.patch 1.3 KB

1234567891011121314151617181920212223242526272829
  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. --- a/list.c
  8. +++ b/list.c
  9. @@ -339,7 +339,18 @@ int list_files(__G) /* return PK-type
  10. G.crec.compression_method == ENHDEFLATED) {
  11. methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3];
  12. } else if (methnum >= NUM_METHODS) {
  13. - sprintf(&methbuf[4], "%03u", G.crec.compression_method);
  14. + /* 2013-02-26 SMS.
  15. + * http://sourceforge.net/p/infozip/bugs/27/ CVE-2014-9913.
  16. + * Unexpectedly large compression methods overflow
  17. + * &methbuf[]. Use the old, three-digit decimal format
  18. + * for values which fit. Otherwise, sacrifice the
  19. + * colon, and use four-digit hexadecimal.
  20. + */
  21. + if (G.crec.compression_method <= 999) {
  22. + sprintf( &methbuf[ 4], "%03u", G.crec.compression_method);
  23. + } else {
  24. + sprintf( &methbuf[ 3], "%04X", G.crec.compression_method);
  25. + }
  26. }
  27. #if 0 /* GRR/Euro: add this? */