diff --git a/src/bin/gzip/Jamfile b/src/bin/gzip/Jamfile index 4eae9b7b5d..264c2acbd2 100644 --- a/src/bin/gzip/Jamfile +++ b/src/bin/gzip/Jamfile @@ -16,10 +16,9 @@ BinCommand gzip : unpack.c unlzh.c crypt.c + : be ; -LinkAgainst gzip : be ; - { MakeLocatePlatform zdiff ; Shell zdiff : zdiff ; diff --git a/src/bin/gzip/gzip.c b/src/bin/gzip/gzip.c index cff9849f7a..ea8d464683 100644 --- a/src/bin/gzip/gzip.c +++ b/src/bin/gzip/gzip.c @@ -45,7 +45,7 @@ static char *license_msg[] = { */ #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.1 2003/06/11 15:56:08 darkwyrm Exp $"; +static char rcsid[] = "$Id$"; #endif #include @@ -1005,7 +1005,14 @@ local int get_istat(iname, sbuf) #ifdef NO_MULTIPLE_DOTS char *dot; /* pointer to ifname extension, or NULL */ #endif + int max_suffix_len = (z_len > 3 ? z_len : 3); + /* Leave enough room in ifname or ofname for suffix: */ + if (strlen(iname) >= sizeof(ifname) - max_suffix_len) { + strncpy(ifname, iname, sizeof(ifname) - 1); + /* last byte of ifname is already zero and never overwritten */ + error("file name too long"); + } strcpy(ifname, iname); /* If input file exists, return OK. */