1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-23 10:50:16 +03:00

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 13:05:49 +02:00 committed by Luca Boccassi
parent a8fe005209
commit 26551c0f67

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: