summaryrefslogtreecommitdiff
blob: 5f0e4ab08a663fab14b74fe3941d54db71da65a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Fix a bug reported by Ulf Harnhammar (patch by him too):
gzip: dir traversal bug when using "gunzip -N"

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=305255
http://bugs.gentoo.org/show_bug.cgi?id=89946

--- gzip-1.3.5/gzip.c
+++ gzip-1.3.5/gzip.c
@@ -1344,6 +1344,8 @@
 			error("corrupted input -- file name too large");
 		    }
 		}
+		char *base2 = base_name (base);   /* strip any paths that may exists */
+		strcpy(base, base2);              /* in the output name */
                 /* If necessary, adapt the name to local OS conventions: */
                 if (!list) {
                    MAKE_LEGAL_NAME(base);