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

2
gzip/gzip.spec

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

Loading…
Cancel
Save