diff options
author | Shawn Routhier <sar@isc.org> | 2013-06-04 10:44:13 -0700 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2013-06-04 10:44:13 -0700 |
commit | 360cc6d99356fcf2d2368193607f8c7032dac8da (patch) | |
tree | 0d3bdc742a09b1ef0af574f01929c780a715a572 | |
parent | 6741869891a5e325fab147aff3b1f2a64c30ddcd (diff) | |
download | isc-dhcp-360cc6d99356fcf2d2368193607f8c7032dac8da.tar.gz |
[master]
Squashed commit of the following:
[rt33351]
Check for overly long whitespace in files we are parsing and
print a message and exit if we find it. We could try and continue
but given that the file is likely corrupt that doesn't seem useful.
commit e5cde5645b6cdeee04761fa3671d9e9f3b5abdd4
commit 25c632ab85e996f89a8e0337a3c5caef6ff4392a
-rw-r--r-- | RELNOTES | 4 | ||||
-rw-r--r-- | common/conflex.c | 10 |
2 files changed, 14 insertions, 0 deletions
@@ -83,6 +83,10 @@ work on other platforms. Please report any problems and suggested fixes to a compiler warning on Solaris using GCC. [ISC-Bugs #33032] +- Add a check for too much whitespace in a config or lease file. + Thanks to Paolo Pellegrino for finding the issue and a suggestion + for the patch. + [ISC-Bugs #33351] Changes since 4.2.4 - Correct code to calculate timing values in client to compare diff --git a/common/conflex.c b/common/conflex.c index 0da5076f..ce688d53 100644 --- a/common/conflex.c +++ b/common/conflex.c @@ -470,6 +470,16 @@ read_whitespace(int c, struct parse *cfile) { */ ofs = 0; do { + if (ofs >= sizeof(cfile->tokbuf)) { + /* + * As the file includes a huge amount of whitespace, + * it's probably broken. + * Print out a warning and bail out. + */ + parse_warn(cfile, + "whitespace too long, buffer overflow."); + log_fatal("Exiting"); + } cfile->tokbuf[ofs++] = c; c = get_char(cfile); } while (!((c == '\n') && cfile->eol_token) && |