dnsproxy: Make sure "rr" is not NULL
authorArjan van de Ven <arjan@linux.intel.com>
Tue, 10 Jan 2012 00:08:21 +0000 (16:08 -0800)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Tue, 10 Jan 2012 12:43:57 +0000 (13:43 +0100)
I've caught some crashes with connman where "rr" ended up being NULL;
easy to add a check for this and prevent the crash.

src/dnsproxy.c

index f3fc30f..cdc5b11 100644 (file)
@@ -579,6 +579,9 @@ static int parse_rr(unsigned char *buf, unsigned char *start,
 
        rr = (void *) (*end);
 
+       if (rr == NULL)
+               return -EINVAL;
+
        *type = ntohs(rr->type);
        *class = ntohs(rr->class);
        *ttl = ntohl(rr->ttl);