summaryrefslogtreecommitdiff
path: root/sldns/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'sldns/parse.c')
-rw-r--r--sldns/parse.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sldns/parse.c b/sldns/parse.c
index 35dee719628ca..e30a753a49bfc 100644
--- a/sldns/parse.c
+++ b/sldns/parse.c
@@ -120,6 +120,10 @@ sldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *l
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;