netbsd-bugs@netbsd.org
[Top] [All Lists]

Re: bin/33045: NetBSD gzip rejects files GNU gzip accepts

Subject: Re: bin/33045: NetBSD gzip rejects files GNU gzip accepts
From: Michael van Elst
Date: Mon, 9 Oct 2006 07:25:02 +0000 UTC
The following reply was made to PR bin/33045; it has been noted by GNATS.

From: Michael van Elst <mlelstv@xxxxxxxxxx>
To: gnats-bugs@xxxxxxxxxx
Cc: 
Subject: Re: bin/33045: NetBSD gzip rejects files GNU gzip accepts
Date: Mon, 9 Oct 2006 09:23:59 +0200

 The following patch will end a decompression when trailing garbage
 is found. It emits a warning message and causes a non-zero exit
 status (similar to GNU gzip).
 
 
 Index: gzip.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/gzip/gzip.c,v
 retrieving revision 1.85
 diff -u -r1.85 gzip.c
 --- gzip.c     27 Sep 2006 22:20:31 -0000      1.85
 +++ gzip.c     9 Oct 2006 07:06:51 -0000
 @@ -751,6 +751,10 @@
                switch (state) {
                case GZSTATE_MAGIC0:
                        if (*z.next_in != GZIP_MAGIC0) {
 +                              if (in_tot > 0) {
 +                                      maybe_warnx("%s: trailing garbage 
ignored", filename);
 +                                      goto stop;
 +                              }
                                maybe_warnx("input not gziped (MAGIC0)");
                                goto stop_and_fail;
                        }
 
 -- 
                                 Michael van Elst
 Internet: mlelstv@xxxxxxxxxx
                                 "A potential Snark may lurk in every tree."
 

<Prev in Thread] Current Thread [Next in Thread>
  • Re: bin/33045: NetBSD gzip rejects files GNU gzip accepts, Michael van Elst <=