[systemd-commits] src/resolve

Thomas H.P. Andersen phomes at kemper.freedesktop.org
Sun Aug 3 14:10:32 PDT 2014


 src/resolve/resolved-dns-scope.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 75cd513ef830d8e00d0d2d6a64917fec533315db
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Sun Aug 3 22:41:25 2014 +0200

    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.

diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index 8d03049..0f654a6 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -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);



More information about the systemd-commits mailing list