Package: ldns / 1.6.17-5

fix-whitespace-bug-in-ldns-read-zone.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From d6037a22fbedb8ef3a22de4107e4eaa36840865b Mon Sep 17 00:00:00 2001
From: Matthijs Mekking <matthijs@nlnetlabs.nl>
Date: Wed, 18 Jun 2014 09:55:17 +0200
Subject: whitespace bug in ldns-read-zone

---
--- ldns.orig/rr.c
+++ ldns/rr.c
@@ -670,6 +670,18 @@ ldns_rr_new_question_frm_str(ldns_rr **n
 	                                    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, FI
 		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);