From: Tommi Rantala Date: Mon, 20 Jan 2025 11:05:49 +0000 (+0200) Subject: resolved: empty "ipv4hint" and "ipv6hint" SvcParams are invalid X-Git-Tag: v258-rc1~1551 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26551c0f67d41dfbc2038db99e31a42632f15db6;p=thirdparty%2Fsystemd.git 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 --- 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: