sysklogd: fix build on musl
[buildroot-gz.git] / package / libldns / 0002-whitespace-bug-in-ldns-read-zone.patch
blobec87b18e095cdc2ca210a435041d271b57a299ba
1 From 055ea6aef77058f651b5571d98d2d9458821a977 Mon Sep 17 00:00:00 2001
2 From: Matthijs Mekking <matthijs@nlnetlabs.nl>
3 Date: Wed, 18 Jun 2014 09:55:17 +0200
4 Subject: [PATCH] whitespace bug in ldns-read-zone
6 [Backport from upstream commit d6037a22fbedb8ef3a22de4107e4eaa36840865b]
7 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
8 ---
9 rr.c | 15 +++++++++++++++
10 1 file changed, 15 insertions(+)
12 diff --git a/rr.c b/rr.c
13 index cfee170..e530702 100644
14 --- a/rr.c
15 +++ b/rr.c
16 @@ -670,6 +670,18 @@ ldns_rr_new_question_frm_str(ldns_rr **newrr, const char *str,
17 true);
20 +static int
21 +ldns_rr_is_whitespace_line(char* line, int line_len)
23 + int i;
24 + for (i = 0; i < line_len; i++) {
25 + if (!isspace((int)line[i])) {
26 + return 0;
27 + }
28 + }
29 + return 1;
32 ldns_status
33 ldns_rr_new_frm_fp(ldns_rr **newrr, FILE *fp, uint32_t *ttl, ldns_rdf **origin, ldns_rdf **prev)
35 @@ -745,6 +757,9 @@ ldns_rr_new_frm_fp_l(ldns_rr **newrr, FILE *fp, uint32_t *default_ttl, ldns_rdf
36 s = LDNS_STATUS_SYNTAX_TTL;
37 } else if (strncmp(line, "$INCLUDE", 8) == 0) {
38 s = LDNS_STATUS_SYNTAX_INCLUDE;
39 + } else if (ldns_rr_is_whitespace_line(line, size)) {
40 + LDNS_FREE(line);
41 + return LDNS_STATUS_SYNTAX_EMPTY;
42 } else {
43 if (origin && *origin) {
44 s = ldns_rr_new_frm_str(&rr, (const char*) line, ttl, *origin, prev);
45 --
46 2.6.4