kumquat-buildroot/package/libldns/0002-whitespace-bug-in-ldns-read-zone.patch

48 lines
1.3 KiB
Diff
Raw Normal View History

From 055ea6aef77058f651b5571d98d2d9458821a977 Mon Sep 17 00:00:00 2001
From: Matthijs Mekking <matthijs@nlnetlabs.nl>
Date: Wed, 18 Jun 2014 09:55:17 +0200
Subject: [PATCH] whitespace bug in ldns-read-zone
[Backport from upstream commit d6037a22fbedb8ef3a22de4107e4eaa36840865b]
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
rr.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/rr.c b/rr.c
index cfee170..e530702 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);
--
2.6.4