1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

resolved: avoid possible dereference of null pointer

In dns_scope_make_reply_packet the structs q, answer, and soa can be
null. We should check for null before reading their fields.
This commit is contained in:
Thomas Hindoe Paaboel Andersen 2014-08-03 22:41:25 +02:00
parent 621ac3d2cc
commit 75cd513ef8

View File

@ -412,7 +412,9 @@ static int dns_scope_make_reply_packet(
assert(s);
if (q->n_keys <= 0 && answer->n_rrs <= 0 && soa->n_rrs <= 0)
if ((!q || q->n_keys <= 0)
&& (!answer || answer->n_rrs <= 0)
&& (!soa || soa->n_rrs <= 0))
return -EINVAL;
r = dns_packet_new(&p, s->protocol, 0);