jobcore/ldns/1acee0c5d35f4a04df07e5d5f4490e6318513997.patch
2022-08-18 11:41:06 +03:00

25 lines
985 B
Diff

From 1acee0c5d35f4a04df07e5d5f4490e6318513997 Mon Sep 17 00:00:00 2001
From: Willem Toorop <willem@nlnetlabs.nl>
Date: Sun, 14 Aug 2022 17:19:02 +0200
Subject: [PATCH] Issue #183 EDNS OPT can have no rdata
---
host2wire.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/host2wire.c b/host2wire.c
index 49e4924a..137257cd 100644
--- a/host2wire.c
+++ b/host2wire.c
@@ -449,7 +449,10 @@ ldns_pkt2buffer_wire_compress(ldns_buffer *buffer, const ldns_pkt *packet, ldns_
, ldns_buffer_export(edns_buf));
ldns_buffer_free(edns_buf);
}
- ldns_rr_push_rdf(edns_rr, edns_rdf ? edns_rdf : packet->_edns_data);
+ if (edns_rdf)
+ ldns_rr_push_rdf(edns_rr, edns_rdf);
+ else if (packet->_edns_data)
+ ldns_rr_push_rdf(edns_rr, packet->_edns_data);
(void)ldns_rr2buffer_wire_compress(buffer, edns_rr, LDNS_SECTION_ADDITIONAL, compression_data);
/* take the edns rdata back out of the rr before we free rr */
if (!edns_rdf)