1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00

resolve: drop recursion in TXT field handling

Fixes #25683.

(cherry picked from commit 494ef16743)
This commit is contained in:
Yu Watanabe 2022-12-10 10:21:41 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent aeb3653744
commit 8ff529fb80

View File

@ -1768,36 +1768,30 @@ int dns_resource_record_get_cname_target(DnsResourceKey *key, DnsResourceRecord
return 0;
}
DnsTxtItem *dns_txt_item_free_all(DnsTxtItem *i) {
DnsTxtItem *n;
DnsTxtItem *dns_txt_item_free_all(DnsTxtItem *first) {
LIST_FOREACH(items, i, first)
free(i);
if (!i)
return NULL;
n = i->items_next;
free(i);
return dns_txt_item_free_all(n);
return NULL;
}
bool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b) {
DnsTxtItem *bb = b;
if (a == b)
return true;
if (!a != !b)
return false;
LIST_FOREACH(items, aa, a) {
if (!bb)
return false;
if (!a)
return true;
if (memcmp_nn(aa->data, aa->length, bb->data, bb->length) != 0)
return false;
if (a->length != b->length)
return false;
bb = bb->items_next;
}
if (memcmp(a->data, b->data, a->length) != 0)
return false;
return dns_txt_item_equal(a->items_next, b->items_next);
return !bb;
}
DnsTxtItem *dns_txt_item_copy(DnsTxtItem *first) {