0021-unzip-6.0-overflow.patch (1034B)
1 diff --git a/extract.c b/extract.c 2 index a0a4929..9ef80b3 100644 3 --- a/extract.c 4 +++ b/extract.c 5 @@ -2214,6 +2214,7 @@ static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) 6 ulg eb_ucsize; 7 uch *eb_ucptr; 8 int r; 9 + ush method; 10 11 if (compr_offset < 4) /* field is not compressed: */ 12 return PK_OK; /* do nothing and signal OK */ 13 @@ -2223,6 +2224,12 @@ static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) 14 eb_size <= (compr_offset + EB_CMPRHEADLEN))) 15 return IZ_EF_TRUNC; /* no compressed data! */ 16 17 + method = makeword(eb + (EB_HEADSIZE + compr_offset)); 18 + if ((method == STORED) && (eb_size != compr_offset + EB_CMPRHEADLEN + eb_ucsize)) 19 + return PK_ERR; /* compressed & uncompressed 20 + * should match in STORED 21 + * method */ 22 + 23 if ( 24 #ifdef INT_16BIT 25 (((ulg)(extent)eb_ucsize) != eb_ucsize) ||