summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/gzip/gzip.c
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>1999-05-28 13:23:27 +0000
committerkris <kris@FreeBSD.org>1999-05-28 13:23:27 +0000
commit2c39f0fd7d079a2cea7dcf8425e931366294a5fe (patch)
treeb7264041624866114e0a4caf0ce7bc6061adc968 /gnu/usr.bin/gzip/gzip.c
parent7e52c731df6a87ccbaa50164c708a3fc6d4800f8 (diff)
downloadFreeBSD-src-2c39f0fd7d079a2cea7dcf8425e931366294a5fe.zip
FreeBSD-src-2c39f0fd7d079a2cea7dcf8425e931366294a5fe.tar.gz
Fixes from OpenBSD:
Add $Id$ Removes temp file exploits in gzexe (predictable filenames) Fixes some typos Fixes a buffer overrun in gzip -S Don't prepend /usr/local/bin to path in scripts Correct location of /usr/share/misc/termcap Obtained from: OpenBSD
Diffstat (limited to 'gnu/usr.bin/gzip/gzip.c')
-rw-r--r--gnu/usr.bin/gzip/gzip.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gnu/usr.bin/gzip/gzip.c b/gnu/usr.bin/gzip/gzip.c
index 7a666ba..08803e3 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.7 1997/03/15 22:43:58 guido Exp $";
+static char rcsid[] = "$Id: gzip.c,v 1.4 1998/11/22 20:03:21 deraadt Exp $";
#endif
#include <ctype.h>
@@ -521,7 +521,13 @@ int main (argc, argv)
if (*optarg == '.') optarg++;
#endif
z_len = strlen(optarg);
- strcpy(z_suffix, optarg);
+ if (z_len > sizeof(z_suffix)-1) {
+ fprintf(stderr, "%s: -S suffix too long\n", progname);
+ usage();
+ do_exit(ERROR);
+ }
+ strncpy(z_suffix, optarg, sizeof z_suffix-1);
+ z_suffix[sizeof z_suffix-1] = '\0';
break;
case 't':
test = decompress = to_stdout = 1;
OpenPOWER on IntegriCloud