]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Check parse limit before t increment
authorWillem Toorop <willem@nlnetlabs.nl>
Wed, 26 Apr 2017 22:14:58 +0000 (00:14 +0200)
committerWillem Toorop <willem@nlnetlabs.nl>
Wed, 26 Apr 2017 22:14:58 +0000 (00:14 +0200)
Thanks Stephan Zeisberg

Changelog
parse.c

index d746ccbe6c42a154e96ca9f3942cb41a4dfcddfa..77861485ecf19871a434b8e24063f44e02f753ac 100644 (file)
--- 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 e68627c25a7259456c24156e1b391e384911e755..947dbb8984f79ebb11f12d92b511b567d8a57789 100644 (file)
--- 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;