From a1eea3bbb1973f3becc4603c3bbad4e96af3361f Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 12 Jan 2021 10:27:26 +0100 Subject: [PATCH] Revert "BUG/MINOR: dns: SRV records ignores duplicated AR records" This reverts commit 949a7f64591458eb06c998acf409093ea991dc3a. The first part of the patch introduces a bug. When a dns answer item is allocated, its is only initialized at the end of the parsing, when the item is added in the answer list. Thus, we must not try to release it during the parsing. The second part is also probably buggy. It fixes the issue #971 but reverts a fix for the issue #841 (see commit fb0884c8297 "BUG/MEDIUM: dns: Don't store additional records in a linked-list"). So it must be at least revalidated. This revert fixes a segfault reported in a comment of the issue #971. It must be backported as far as 2.2. --- src/dns.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/dns.c b/src/dns.c index 4f7ed4b50..d71a5d302 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1027,10 +1027,6 @@ static int dns_validate_dns_response(unsigned char *resp, unsigned char *bufend, dns_answer_record->data_len = len; memcpy(dns_answer_record->target, tmpname, len); dns_answer_record->target[len] = 0; - if (dns_answer_record->ar_item != NULL) { - pool_free(dns_answer_item_pool, dns_answer_record->ar_item); - dns_answer_record->ar_item = NULL; - } break; case DNS_RTYPE_AAAA: @@ -1280,7 +1276,6 @@ static int dns_validate_dns_response(unsigned char *resp, unsigned char *bufend, // looking for the SRV record in the response list linked to this additional record list_for_each_entry(tmp_record, &dns_p->answer_list, list) { if (tmp_record->type == DNS_RTYPE_SRV && - tmp_record->ar_item == NULL && !dns_hostname_cmp(tmp_record->target, dns_answer_record->name, tmp_record->data_len)) { /* Always use the received additional record to refresh info */ if (tmp_record->ar_item)