diff options
-rw-r--r-- | gnu/usr.bin/gzip/gzip.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gnu/usr.bin/gzip/gzip.c b/gnu/usr.bin/gzip/gzip.c index 0fad2d46ff5..5eb0b243309 100644 --- a/gnu/usr.bin/gzip/gzip.c +++ b/gnu/usr.bin/gzip/gzip.c @@ -45,7 +45,7 @@ static char *license_msg[] = { */ #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.4 1998/11/22 20:03:21 deraadt Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.5 2002/03/13 18:14:18 millert Exp $"; #endif #include <ctype.h> @@ -1011,8 +1011,10 @@ 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); - if (strlen(iname) >= sizeof(ifname) - 3) { + /* Make sure there is enough room in ifname for iname + suffix. */ + if (strlen(iname) >= sizeof(ifname) - max_suffix_len) { errno = ENAMETOOLONG; perror(iname); exit_code = ERROR; |