You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
694 B

  1. From c8391790c96d4c8a2c10f9ab1460fda83b509fc2 Mon Sep 17 00:00:00 2001
  2. From: Willem Toorop <willem@nlnetlabs.nl>
  3. Date: Thu, 27 Apr 2017 00:14:58 +0200
  4. Subject: [PATCH] Check parse limit before t increment
  5. Thanks Stephan Zeisberg
  6. ---
  7. parse.c | 4 ++++
  8. 1 file changed, 4 insertions(+)
  9. diff --git a/parse.c b/parse.c
  10. index e68627c..947dbb8 100644
  11. --- a/parse.c
  12. +++ b/parse.c
  13. @@ -118,6 +118,10 @@ ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *li
  14. if (line_nr) {
  15. *line_nr = *line_nr + 1;
  16. }
  17. + if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) {
  18. + *t = '\0';
  19. + return -1;
  20. + }
  21. *t++ = ' ';
  22. prev_c = c;
  23. continue;
  24. --
  25. 2.9.5