diff options
author | wosch <wosch@FreeBSD.org> | 1997-12-27 03:38:39 +0000 |
---|---|---|
committer | wosch <wosch@FreeBSD.org> | 1997-12-27 03:38:39 +0000 |
commit | 211f7190b6b02af9a5d2bd96a8eb4e2040da1166 (patch) | |
tree | 6d84ed01109f07c21c4b546cdd116c1c14658f08 /gnu/usr.bin/gzip | |
parent | c97344001f693a486eb9636bb236dfe47da0511f (diff) | |
download | FreeBSD-src-211f7190b6b02af9a5d2bd96a8eb4e2040da1166.zip FreeBSD-src-211f7190b6b02af9a5d2bd96a8eb4e2040da1166.tar.gz |
Check argument filename length before copying.
$ gzip `perl -e 'for(1..10240){ print "a"}'`
Diffstat (limited to 'gnu/usr.bin/gzip')
-rw-r--r-- | gnu/usr.bin/gzip/gzip.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gnu/usr.bin/gzip/gzip.c b/gnu/usr.bin/gzip/gzip.c index 87ab36a..7a666ba 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.6 1997/02/22 15:45:57 peter Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.7 1997/03/15 22:43:58 guido Exp $"; #endif #include <ctype.h> @@ -1006,6 +1006,13 @@ local int get_istat(iname, sbuf) char *dot; /* pointer to ifname extension, or NULL */ #endif + if (strlen(iname) >= sizeof(ifname) - 3) { + errno = ENAMETOOLONG; + perror(iname); + exit_code = ERROR; + return ERROR; + } + strcpy(ifname, iname); /* If input file exists, return OK. */ |