gzip: fix a data-loss bug when decompressing with --suffix=''
[debian/gzip] / gzip.c
diff --git a/gzip.c b/gzip.c
index 66cb80436e59326aa104208cafcb0c2b59cad1d9..d1105e56b5781b8538eacd9fe40cf8b42a2276c9 100644 (file)
--- a/gzip.c
+++ b/gzip.c
@@ -543,11 +543,11 @@ int main (int argc, char **argv)
                 program_name);
     }
 #endif
-    if ((z_len == 0 && !decompress) || z_len > MAX_SUFFIX) {
-        fprintf(stderr, "%s: incorrect suffix '%s'\n",
-                program_name, z_suffix);
+    if (z_len == 0 || z_len > MAX_SUFFIX) {
+        fprintf(stderr, "%s: invalid suffix '%s'\n", program_name, z_suffix);
         do_exit(ERROR);
     }
+
     if (do_lzw && !decompress) work = lzw;
 
     /* Allocate all global buffers (for DYN_ALLOC option) */