diff options
| author | Kris Kennaway <kris@FreeBSD.org> | 2000-08-04 06:25:30 +0000 |
|---|---|---|
| committer | Kris Kennaway <kris@FreeBSD.org> | 2000-08-04 06:25:30 +0000 |
| commit | cd79a42a809ab270ce5f8bb804f5c37c83174bdc (patch) | |
| tree | bb33e87ef7d8b378bb0b7c548563562917c3ca5b /lib/libz | |
| parent | 2efeedfd4bd92c858b04339a8ef87394988b2f57 (diff) | |
Notes
Diffstat (limited to 'lib/libz')
| -rw-r--r-- | lib/libz/minigzip.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libz/minigzip.c b/lib/libz/minigzip.c index ba4b2dc9e8df..e8a61b13e711 100644 --- a/lib/libz/minigzip.c +++ b/lib/libz/minigzip.c @@ -200,6 +200,11 @@ void file_compress(file, mode) FILE *in; gzFile out; + if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { + fprintf(stderr, "%s: nilename too long\n", prog); + exit(1); + } + strcpy(outfile, file); strcat(outfile, GZ_SUFFIX); @@ -231,6 +236,11 @@ void file_uncompress(file) gzFile in; int len = strlen(file); + if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { + fprintf(stderr, "%s: filename too long\n", prog); + exit(1); + } + strcpy(buf, file); if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { |
