From 6589d555200e06835d5a8eb38fb87dc1b9ae6bf1 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 24 Sep 2010 20:42:31 +0200 Subject: Do not access the DNS request buffer if it's NULL --- plugins/dnsproxy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/dnsproxy.c b/plugins/dnsproxy.c index 63c88b98..ac184900 100644 --- a/plugins/dnsproxy.c +++ b/plugins/dnsproxy.c @@ -482,11 +482,14 @@ static gboolean tcp_server_event(GIOChannel *channel, GIOCondition condition, for (list = request_list; list; list = list->next) { struct request_data *req = list->data; - struct domain_hdr *hdr = (void *) (req->request + 2); + struct domain_hdr *hdr; if (req->protocol == IPPROTO_UDP) continue; + if (req->request == NULL) + continue; + /* * If we're not waiting for any further response * from another name server, then we send an error @@ -495,6 +498,7 @@ static gboolean tcp_server_event(GIOChannel *channel, GIOCondition condition, if (req->numserv && --(req->numserv)) continue; + hdr = (void *) (req->request + 2); hdr->id = req->srcid; send_response(req->client_sk, req->request, req->request_len, NULL, 0, IPPROTO_TCP); -- cgit v1.2.3