First Commit
[librecmc/package-feed.git] / utils / unzip / patches / 004-CVE-2014-9636-test-compr-eb.patch
1 --- a/extract.c
2 +++ b/extract.c
3 @@ -2228,6 +2228,7 @@ static int test_compr_eb(__G__ eb, eb_si
4      ulg eb_ucsize;
5      uch *eb_ucptr;
6      int r;
7 +    ush eb_compr_method;
8  
9      if (compr_offset < 4)                /* field is not compressed: */
10          return PK_OK;                    /* do nothing and signal OK */
11 @@ -2244,6 +2245,14 @@ static int test_compr_eb(__G__ eb, eb_si
12       ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN))))
13          return IZ_EF_TRUNC;             /* no/bad compressed data! */
14  
15 +    /* 2014-11-03 Michal Zalewski, SMS.
16 +     * For STORE method, compressed and uncompressed sizes must agree.
17 +     * http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=450
18 +     */
19 +    eb_compr_method = makeword( eb + (EB_HEADSIZE + compr_offset));
20 +    if ((eb_compr_method == STORED) && (eb_size - compr_offset != eb_ucsize))
21 +        return PK_ERR;
22 +
23      if (
24  #ifdef INT_16BIT
25          (((ulg)(extent)eb_ucsize) != eb_ucsize) ||