mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Prevent buffer overflows.
This commit is contained in:
parent
2efeedfd4b
commit
cd79a42a80
1 changed files with 10 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue