summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthijs Mekking <matthijs@nlnetlabs.nl>2014-06-18 09:55:17 +0200
committerMatthijs Mekking <matthijs@nlnetlabs.nl>2014-06-18 09:55:17 +0200
commitd6037a22fbedb8ef3a22de4107e4eaa36840865b (patch)
tree6025d28b1c7b28fffe186a5772e04c2fa5fb1ff5
parent7e9410104888e6af7db4ff726fef390fa04f5fbe (diff)
downloadldns-d6037a22fbedb8ef3a22de4107e4eaa36840865b.tar.gz
whitespace bug in ldns-read-zone
-rw-r--r--rr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/rr.c b/rr.c
index 5fe4f6ee..671c4ebd 100644
--- a/rr.c
+++ b/rr.c
@@ -670,6 +670,18 @@ ldns_rr_new_question_frm_str(ldns_rr **newrr, const char *str,
true);
}
+static int
+ldns_rr_is_whitespace_line(char* line, int line_len)
+{
+ int i;
+ for (i = 0; i < line_len; i++) {
+ if (!isspace((int)line[i])) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
ldns_status
ldns_rr_new_frm_fp(ldns_rr **newrr, FILE *fp, uint32_t *ttl, ldns_rdf **origin, ldns_rdf **prev)
{
@@ -745,6 +757,9 @@ ldns_rr_new_frm_fp_l(ldns_rr **newrr, FILE *fp, uint32_t *default_ttl, ldns_rdf
s = LDNS_STATUS_SYNTAX_TTL;
} else if (strncmp(line, "$INCLUDE", 8) == 0) {
s = LDNS_STATUS_SYNTAX_INCLUDE;
+ } else if (ldns_rr_is_whitespace_line(line, size)) {
+ LDNS_FREE(line);
+ return LDNS_STATUS_SYNTAX_EMPTY;
} else {
if (origin && *origin) {
s = ldns_rr_new_frm_str(&rr, (const char*) line, ttl, *origin, prev);