]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix dnsserv.c assertion when no supported questions are requested.
authorScott Dial <scott@scottdial.com>
Wed, 4 May 2016 18:45:09 +0000 (14:45 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 4 May 2016 18:45:09 +0000 (14:45 -0400)
The problem is that "q" is always set on the first iteration even
if the question is not a supported question. This set of "q" is
not necessary, and will be handled after exiting the loop if there
if a supported q->type was found.

    [Changes file by nickm]

lease enter the commit message for your changes. Lines starting

changes/bug18710 [new file with mode: 0644]
src/or/dnsserv.c

diff --git a/changes/bug18710 b/changes/bug18710
new file mode 100644 (file)
index 0000000..2693955
--- /dev/null
@@ -0,0 +1,6 @@
+  o Major bugfixes (DNS proxy):
+    - Stop a crash that could occur when a client running with DNSPort
+      received a query with multiple address types, where the first
+      address type was not supported. Found and fixed by Scott Dial.
+      Fixes bug 18710; bugfix on 0.2.5.4-alpha.
+
index ecd45be77c29f5b3b174ac7bffaa335f97ee54c2..9b0368dd09d7ec0b25c7d852b60f08e28493bf7a 100644 (file)
@@ -87,8 +87,6 @@ evdns_server_callback(struct evdns_server_request *req, void *data_)
   for (i = 0; i < req->nquestions; ++i) {
     if (req->questions[i]->dns_question_class != EVDNS_CLASS_INET)
       continue;
-    if (! q)
-      q = req->questions[i];
     switch (req->questions[i]->type) {
       case EVDNS_TYPE_A:
       case EVDNS_TYPE_AAAA:
@@ -96,7 +94,7 @@ evdns_server_callback(struct evdns_server_request *req, void *data_)
         /* We always pick the first one of these questions, if there is
            one. */
         if (! supported_q)
-          supported_q = q;
+          supported_q = req->questions[i];
         break;
       default:
         break;