From: Willem Toorop Date: Wed, 26 Apr 2017 22:14:58 +0000 (+0200) Subject: Check parse limit before t increment X-Git-Tag: release-1.7.1-rc1~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8391790c96d4c8a2c10f9ab1460fda83b509fc2;p=thirdparty%2Fldns.git Check parse limit before t increment Thanks Stephan Zeisberg --- diff --git a/Changelog b/Changelog index d746ccbe..77861485 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,6 @@ 1.7.1 ????-??-?? + * bugfix #1256: Check parse limit before t increment + Thanks Stephan Zeisberg * bugfix #1245: Only one signature per RRset needs to be valid with ldns-verify-zone. Thanks Emil Natan. * ldns-notify can use all supported hash algorithms with -y. diff --git a/parse.c b/parse.c index e68627c2..947dbb89 100644 --- a/parse.c +++ b/parse.c @@ -118,6 +118,10 @@ ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *li if (line_nr) { *line_nr = *line_nr + 1; } + if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { + *t = '\0'; + return -1; + } *t++ = ' '; prev_c = c; continue;