Index: head/archivers/unzip/Makefile =================================================================== --- head/archivers/unzip/Makefile (revision 405285) +++ head/archivers/unzip/Makefile (revision 405286) @@ -1,102 +1,102 @@ # Created by: jmz # $FreeBSD$ PORTNAME= unzip PORTVERSION= 6.0 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= archivers MASTER_SITES= SF/infozip/UnZip%206.x%20%28latest%29/UnZip%20${PORTVERSION}/:main \ SF/infozip/UnZip%205.x%20and%20earlier/5.51/:unreduce DISTNAME= ${PORTNAME}60 DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:main MAINTAINER= ehaupt@FreeBSD.org COMMENT= List, test, and extract compressed files from a ZIP archive LICENSE= Info-ZIP LICENSE_NAME= Info-ZIP license LICENSE_FILE= ${WRKSRC}/LICENSE LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept USES= cpe CPE_VENDOR= info-zip ALL_TARGET= bsd MAKEFILE= unix/Makefile MAKE_ARGS= LF2="${STRIP}" PORTDOCS= README WHERE MANPAGES= unzip.1 funzip.1 unzipsfx.1 zipgrep.1 zipinfo.1 PLIST_FILES= bin/unzip bin/funzip bin/unzipsfx bin/zipgrep \ bin/zipinfo PLIST_FILES+= ${MANPAGES:C|^(.*)\.([1-9])$|man/man\2/\1.\2.gz|} LOCAL_UNZIP= ${CFLAGS} -DACORN_FTYPE_NFS -DWILD_STOP_AT_DIR \ -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE -D_MBCS \ -DLARGE_FILE_SUPPORT MAKE_ENV= LOCAL_UNZIP="${LOCAL_UNZIP}" \ D_USE_BZ2=-DUSE_BZIP2 L_BZ2=-lbz2 .ifdef USE_UNZIP .error You have "USE_UNZIP" variable defined in environment or in \ make(1) arguments. Please undefine and try again. .endif OPTIONS_DEFINE= DOCS ICONV OPTIONS_RADIO= RG1 OPTIONS_RADIO_RG1= CHINESE KOREAN RUSSIAN RG1_DESC= Localization CHINESE_DESC= Chinese language support KOREAN_DESC= Korean language support RUSSIAN_DESC= CP866 and KOI8-R support ICONV_USES= iconv .include .if ${ARCH} == i386 ALL_TARGET= freebsd .endif .if ${PORT_OPTIONS:MICONV} CFLAGS+= -I${LOCALBASE}/include -DNATIVE MAKE_ARGS+= LFLAGS1="-L${LOCALBASE}/lib ${ICONV_LIB}" EXTRA_PATCHES+= ${FILESDIR}/extra-iconv-patch-unix_unix.c \ ${FILESDIR}/extra-iconv-patch-unix_unxcfg.h \ ${FILESDIR}/extra-iconv-patch-unzip.c \ ${FILESDIR}/extra-iconv-patch-unzpriv.h \ ${FILESDIR}/extra-iconv-patch-zipinfo.c .endif .if ${PORT_OPTIONS:MCHINESE} CATEGORES+= chinese EXTRA_PATCHES+= ${FILESDIR}/extra-zh-patch-fileio.c .endif .if ${PORT_OPTIONS:MKOREAN} CATEGORIES+= korean EXTRA_PATCHES+= ${FILESDIR}/extra-ko-patch-fileio.c \ ${FILESDIR}/extra-ko-patch-unzip.c \ ${FILESDIR}/extra-ko-patch-unzip.h .endif .if ${PORT_OPTIONS:MRUSSIAN} CATEGORIES+= russian EXTRA_PATCHES+= ${FILESDIR}/extra-ru-patch-ebcdic.h .endif do-install: ${INSTALL_PROGRAM} ${WRKSRC}/unzip \ ${STAGEDIR}${PREFIX}/bin cd ${WRKSRC} && \ ${INSTALL_PROGRAM} funzip unzipsfx ${STAGEDIR}${PREFIX}/bin ${LN} -sf unzip ${STAGEDIR}${PREFIX}/bin/zipinfo ${INSTALL_SCRIPT} ${WRKSRC}/unix/zipgrep ${STAGEDIR}${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/man/unzip.1 \ ${STAGEDIR}${MAN1PREFIX}/man/man1 cd ${WRKSRC}/man && ${INSTALL_MAN} ${MANPAGES:Nunzip.1:Ninfo-unzip.1} \ ${STAGEDIR}${MAN1PREFIX}/man/man1 @${MKDIR} ${STAGEDIR}${DOCSDIR} cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR} .include Index: head/archivers/unzip/files/patch-crypt.c =================================================================== --- head/archivers/unzip/files/patch-crypt.c (nonexistent) +++ head/archivers/unzip/files/patch-crypt.c (revision 405286) @@ -0,0 +1,21 @@ +--- crypt.c.orig 2007-01-05 16:47:36.000000000 +0100 ++++ crypt.c 2016-01-04 14:39:27.300502995 +0100 +@@ -465,7 +465,17 @@ + GLOBAL(pInfo->encrypted) = FALSE; + defer_leftover_input(__G); + for (n = 0; n < RAND_HEAD_LEN; n++) { +- b = NEXTBYTE; ++ /* 2012-11-23 SMS. (OUSPG report.) ++ * Quit early if compressed size < HEAD_LEN. The resulting ++ * error message ("unable to get password") could be improved, ++ * but it's better than trying to read nonexistent data, and ++ * then continuing with a negative G.csize. (See ++ * fileio.c:readbyte()). ++ */ ++ if ((b = NEXTBYTE) == (ush)EOF) ++ { ++ return PK_ERR; ++ } + h[n] = (uch)b; + Trace((stdout, " (%02x)", h[n])); + } Property changes on: head/archivers/unzip/files/patch-crypt.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/archivers/unzip/files/patch-extract.c =================================================================== --- head/archivers/unzip/files/patch-extract.c (revision 405285) +++ head/archivers/unzip/files/patch-extract.c (revision 405286) @@ -1,77 +1,90 @@ ---- extract.c.orig 2009-03-14 01:32:52 UTC -+++ extract.c +--- extract.c.orig 2009-03-14 02:32:52.000000000 +0100 ++++ extract.c 2016-01-04 14:43:11.813488458 +0100 @@ -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[] = +@@ -298,6 +298,8 @@ #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_l +@@ -2023,7 +2025,8 @@ 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_l +@@ -2032,6 +2035,16 @@ 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: -@@ -2217,14 +2230,28 @@ static int test_compr_eb(__G__ eb, eb_si +@@ -2217,14 +2230,28 @@ ulg eb_ucsize; uch *eb_ucptr; int r; + ush method; if (compr_offset < 4) /* field is not compressed: */ return PK_OK; /* do nothing and signal OK */ + /* Return no/bad-data error status if any problem is found: + * 1. eb_size is too small to hold the uncompressed size + * (eb_ucsize). (Else extract eb_ucsize.) + * 2. eb_ucsize is zero (invalid). 2014-12-04 SMS. + * 3. eb_ucsize is positive, but eb_size is too small to hold + * the compressed data header. + */ if ((eb_size < (EB_UCSIZE_P + 4)) || - ((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L && - eb_size <= (compr_offset + EB_CMPRHEADLEN))) - return IZ_EF_TRUNC; /* no compressed data! */ + ((eb_ucsize = makelong( eb+ (EB_HEADSIZE+ EB_UCSIZE_P))) == 0L) || + ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN)))) + return IZ_EF_TRUNC; /* no/bad compressed data! */ + + method = makeword(eb + (EB_HEADSIZE + compr_offset)); + if ((method == STORED) && (eb_size - compr_offset != eb_ucsize)) + return PK_ERR; /* compressed & uncompressed + * should match in STORED + * method */ if ( #ifdef INT_16BIT +@@ -2701,6 +2728,12 @@ + int repeated_buf_err; + bz_stream bstrm; + ++ if (G.incnt <= 0 && G.csize <= 0L) { ++ /* avoid an infinite loop */ ++ Trace((stderr, "UZbunzip2() got empty input\n")); ++ return 2; ++ } ++ + #if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) + wsize = G.redirect_size, redirSlide = G.redirect_buffer;