]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
the condition test for checking the client cookie value was wrong; don't call process...
authorMark Andrews <marka@isc.org>
Tue, 5 Feb 2019 23:08:47 +0000 (10:08 +1100)
committerMark Andrews <marka@isc.org>
Wed, 6 Feb 2019 02:14:09 +0000 (13:14 +1100)
(cherry picked from commit d9c368eee0826a3fbf7111e591dedcf53cb66c0b)

bin/dig/dighost.c

index 3cd4ac3e712543cb682037cfea6f3e2b2a6a6a40..c54439f41b2557ec47a7ed50a276033e4a5cf437 100644 (file)
@@ -3716,7 +3716,7 @@ process_cookie(dig_lookup_t *l, dns_message_t *msg,
        }
 
        INSIST(msg->cc_ok == 0 && msg->cc_bad == 0);
-       if (optlen >= len && optlen >= 8U) {
+       if (len >= 8 && optlen >= 8U) {
                if (isc_safe_memequal(isc_buffer_current(optbuf), sent, 8)) {
                        msg->cc_ok = 1;
                } else {
@@ -3806,6 +3806,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
        dig_lookup_t *n, *l;
        bool docancel = false;
        bool match = true;
+       bool done_process_opt = false;
        unsigned int parseflags;
        dns_messageid_t id;
        unsigned int msgflags;
@@ -4116,6 +4117,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
                        UNLOCK_LOOKUP;
                        return;
                }
+               done_process_opt = true;
        }
        if ((msg->rcode == dns_rcode_servfail && !l->servfail_stops) ||
            (check_ra && (msg->flags & DNS_MESSAGEFLAG_RA) == 0 && l->recurse))
@@ -4205,13 +4207,17 @@ recv_done(isc_task_t *task, isc_event_t *event) {
                }
        }
 
-       if (l->cookie != NULL) {
-               if (msg->opt == NULL)
-                       printf(";; expected opt record in response\n");
-               else
+       if (!done_process_opt) {
+               if (l->cookie != NULL) {
+                       if (msg->opt == NULL) {
+                               printf(";; expected opt record in response\n");
+                       } else {
+                               process_opt(l, msg);
+                       }
+               } else if (l->sendcookie && msg->opt != NULL) {
                        process_opt(l, msg);
-       } else if (l->sendcookie && msg->opt != NULL)
-               process_opt(l, msg);
+               }
+       }
        if (!l->doing_xfr || l->xfr_q == query) {
                if (msg->rcode == dns_rcode_nxdomain &&
                    (l->origin != NULL || l->need_search)) {