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
This commit is contained in:
Tommi Rantala
2025-01-20 19:03:09 +00:00
committed by Luca Boccassi
parent a8fe005209
commit 26551c0f67
+2 -2
View File
@@ -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: