diff options
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/gzip/gzip.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gnu/usr.bin/gzip/gzip.c b/gnu/usr.bin/gzip/gzip.c index b59b4d1..06b0a32 100644 --- a/gnu/usr.bin/gzip/gzip.c +++ b/gnu/usr.bin/gzip/gzip.c @@ -1011,14 +1011,15 @@ 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) { + /* Leave enough room in ifname or ofname for suffix: */ + if (strlen(iname) >= sizeof(ifname) - max_suffix_len) { errno = ENAMETOOLONG; perror(iname); exit_code = ERROR; return ERROR; } - strcpy(ifname, iname); /* If input file exists, return OK. */ |