diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-03-13 18:14:19 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-03-13 18:14:19 +0000 |
commit | ade140d2f64c0286ec3f0a8cc5634f5221b420a3 (patch) | |
tree | ba6b67c724e261855f755de4bc611970c672bf70 /gnu | |
parent | da3186afab3cfdb62d04bd3818ff14076e6b160a (diff) |
User may specify a suffix longer than 3 characters. Take this into
account when sanity checking buffer size; itojun@
Diffstat (limited to 'gnu')
-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; |