From 26551c0f67d41dfbc2038db99e31a42632f15db6 Mon Sep 17 00:00:00 2001 From: Tommi Rantala Date: Mon, 20 Jan 2025 13:05:49 +0200 Subject: [PATCH] resolved: empty "ipv4hint" and "ipv6hint" SvcParams are invalid According to RFC 9460 "An empty list of addresses is invalid." https://www.rfc-editor.org/rfc/rfc9460.html#section-7.3 --- src/resolve/resolved-dns-packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c index 4c82d38bcc2..1d235b4aff7 100644 --- a/src/resolve/resolved-dns-packet.c +++ b/src/resolve/resolved-dns-packet.c @@ -1789,9 +1789,9 @@ static bool dns_svc_param_is_valid(DnsSvcParam *i) { /* RFC 9460, section 7.3: addrs must exactly fill SvcParamValue */ case DNS_SVC_PARAM_KEY_IPV4HINT: - return i->length % (sizeof (struct in_addr)) == 0; + return i->length > 0 && i->length % (sizeof (struct in_addr)) == 0; case DNS_SVC_PARAM_KEY_IPV6HINT: - return i->length % (sizeof (struct in6_addr)) == 0; + return i->length > 0 && i->length % (sizeof (struct in6_addr)) == 0; /* Otherwise, permit any value */ default: -- 2.47.3