summaryrefslogtreecommitdiff
path: root/sldns/parse.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2018-05-12 11:54:35 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2018-05-12 11:54:35 +0000
commit15de2de8449b4f5063f93578ae68aa0bc79a205c (patch)
treef0a7e3230212205e7ff88a2900de97026940f63c /sldns/parse.c
parent689b65913bba5320ef50befddf4743c6dafde873 (diff)
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;