Browse Source

Changed security fix for OpenPKG-SA-2005.009-gzip.html. The previous version caused gzip to always put the results in the current directory.

master
Thomas Lotterer 21 years ago committed by Ralf S. Engelschall
parent
commit
7cf7ab27ba
  1. 36
      gzip/gzip.patch
  2. 2
      gzip/gzip.spec

36
gzip/gzip.patch

@ -23,21 +23,23 @@ Index: gzip.c
#ifndef MAXSEG_64K #ifndef MAXSEG_64K
DECLARE(ush, tab_prefix, 1L<<BITS); DECLARE(ush, tab_prefix, 1L<<BITS);
#else #else
@@ -915,6 +946,7 @@ Index: gzip.c
{ --- gzip.c.orig 2002-09-28 09:38:43.000000000 +0200
struct stat ostat; /* stat for ofname */ +++ gzip.c 2005-07-24 18:20:41.621179000 +0200
int flags = O_WRONLY | O_CREAT | O_EXCL | O_BINARY; @@ -1225,6 +1225,7 @@
+ char *baseout; char magic[2]; /* magic header */
int imagic1; /* like magic[1], but can represent EOF */
ulg stamp; /* time stamp */
+ char *base2;
if (ascii && decompress) { /* If --force and --stdout, zcat == cat, so do not complain about
flags &= ~O_BINARY; /* force ascii text mode */ * premature end of file: use try_byte instead of get_byte.
@@ -927,6 +959,9 @@ @@ -1324,6 +1325,8 @@
} error("corrupted input -- file name too large");
/* Create the output file */ }
remove_ofname = 1; }
+ baseout = base_name(ofname); + base2 = base_name (base);
+ strncpy(ofname, baseout, sizeof(ofname)); + strcpy(base, base2);
+ ofname[sizeof(ofname) - 1] = '\0'; /* If necessary, adapt the name to local OS conventions: */
ofd = OPEN(ofname, flags, RW_USER); if (!list) {
if (ofd == -1) { MAKE_LEGAL_NAME(base);
progerror(ofname);

2
gzip/gzip.spec

@ -33,7 +33,7 @@ Class: CORE
Group: Compression Group: Compression
License: GPL License: GPL
Version: 1.3.5 Version: 1.3.5
Release: 20050611 Release: 20050724
# list of sources # list of sources
Source0: ftp://alpha.gnu.org/gnu/gzip/gzip-%{version}.tar.gz Source0: ftp://alpha.gnu.org/gnu/gzip/gzip-%{version}.tar.gz

Loading…
Cancel
Save