61 lines
2.2 KiB
Diff
61 lines
2.2 KiB
Diff
|
From 916cf1e7907f9d660bd160eb9a84f6e1cab3af5a Mon Sep 17 00:00:00 2001
|
||
|
From: Thorsten Behrens <tbehrens@suse.com>
|
||
|
Date: Sat, 20 Dec 2014 00:24:54 +0100
|
||
|
Subject: [PATCH 1/2] Fix CVE-2014-8139 unzip
|
||
|
|
||
|
Fix heap overflow condition in the CRC32 verification.
|
||
|
---
|
||
|
extract.c | 17 +++++++++++++++--
|
||
|
1 file changed, 15 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/extract.c b/extract.c
|
||
|
index 9582da5..78f637e 100644
|
||
|
--- a/extract.c
|
||
|
+++ b/extract.c
|
||
|
@@ -1,5 +1,5 @@
|
||
|
/*
|
||
|
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
|
||
|
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
|
||
|
|
||
|
See the accompanying file LICENSE, version 2009-Jan-02 or later
|
||
|
(the contents of which are also included in unzip.h) for terms of use.
|
||
|
@@ -298,6 +298,8 @@ char ZCONST Far TruncNTSD[] =
|
||
|
#ifndef SFX
|
||
|
static ZCONST char Far InconsistEFlength[] = "bad extra-field entry:\n \
|
||
|
EF block length (%u bytes) exceeds remaining EF data (%u bytes)\n";
|
||
|
+ static ZCONST char Far TooSmallEFlength[] = "bad extra-field entry:\n \
|
||
|
+ EF block length (%u bytes) invalid (< %d)\n";
|
||
|
static ZCONST char Far InvalidComprDataEAs[] =
|
||
|
" invalid compressed data for EAs\n";
|
||
|
# if (defined(WIN32) && defined(NTSD_EAS))
|
||
|
@@ -2023,7 +2025,8 @@ static int TestExtraField(__G__ ef, ef_len)
|
||
|
ebID = makeword(ef);
|
||
|
ebLen = (unsigned)makeword(ef+EB_LEN);
|
||
|
|
||
|
- if (ebLen > (ef_len - EB_HEADSIZE)) {
|
||
|
+ if (ebLen > (ef_len - EB_HEADSIZE))
|
||
|
+ {
|
||
|
/* Discovered some extra field inconsistency! */
|
||
|
if (uO.qflag)
|
||
|
Info(slide, 1, ((char *)slide, "%-22s ",
|
||
|
@@ -2032,6 +2035,16 @@ static int TestExtraField(__G__ ef, ef_len)
|
||
|
ebLen, (ef_len - EB_HEADSIZE)));
|
||
|
return PK_ERR;
|
||
|
}
|
||
|
+ else if (ebLen < EB_HEADSIZE)
|
||
|
+ {
|
||
|
+ /* Extra block length smaller than header length. */
|
||
|
+ if (uO.qflag)
|
||
|
+ Info(slide, 1, ((char *)slide, "%-22s ",
|
||
|
+ FnFilter1(G.filename)));
|
||
|
+ Info(slide, 1, ((char *)slide, LoadFarString(TooSmallEFlength),
|
||
|
+ ebLen, EB_HEADSIZE));
|
||
|
+ return PK_ERR;
|
||
|
+ }
|
||
|
|
||
|
switch (ebID) {
|
||
|
case EF_OS2:
|
||
|
--
|
||
|
1.8.4.5
|
||
|
|