systemd: accept encoded domain names without terminating zero label

Backport the following fix from systemd:

30675a6ee9

This fixes NMCI test failure for test "dhcpv6_hostname".
This commit is contained in:
Beniamino Galvani 2025-01-29 11:51:18 +01:00
parent 5e3b46411c
commit 4c9af3155b

View file

@ -932,9 +932,12 @@ int dns_name_from_wire_format(const uint8_t **data, size_t *len, char **ret) {
const char *label;
uint8_t c;
/* Unterminated name */
/* RFC 4704 § 4: fully qualified domain names include the terminating
* zero-length label, partial names don't. According to the RFC, DHCPv6
* servers should always send the fully qualified name, but that's not
* true in practice. Also accept partial names. */
if (optlen == 0)
return -EBADMSG;
break;
/* RFC 1035 § 3.1 total length of encoded name is limited to 255 octets */
if (*len - optlen > 255)