[ldns-users] [PATCH 1/2] ldns_wire2pkt: fix null pointer dereference if pkt allocation fails
Jan Vcelak
jv at fcelda.cz
Tue Apr 4 14:28:55 UTC 2017
---
wire2host.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/wire2host.c b/wire2host.c
index 680d2f9d..0788e7bc 100644
--- a/wire2host.c
+++ b/wire2host.c
@@ -412,6 +412,10 @@ ldns_wire2pkt(ldns_pkt **packet_p, const uint8_t *wire, size_t max)
uint8_t data[4];
+ if (!packet) {
+ return LDNS_STATUS_MEM_ERR;
+ }
+
status = ldns_wire2pkt_hdr(packet, wire, max, &pos);
LDNS_STATUS_CHECK_GOTO(status, status_error);
--
2.12.2
More information about the ldns-users
mailing list