]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: empty "ipv4hint" and "ipv6hint" SvcParams are invalid
authorTommi Rantala <tommi.rantala@cujo.com>
Mon, 20 Jan 2025 11:05:49 +0000 (13:05 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 20 Jan 2025 19:03:09 +0000 (19:03 +0000)
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

index 4c82d38bcc29072cba9630241efdbb8092aa91ba..1d235b4aff78a206d95bbe0d00694fc1ed359c36 100644 (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: