1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

Merge pull request #28138 from pkern/oci-dhcpv6

sd-dhcp6-lease: Ignore invalid bytes at the end of the packet
This commit is contained in:
Luca Boccassi 2023-06-29 22:17:02 +01:00 committed by GitHub
commit 1d2b93ff89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -465,6 +465,11 @@ static int dhcp6_lease_parse_message(
size_t optlen;
const uint8_t *optval;
if (len - offset < offsetof(DHCP6Option, data)) {
log_dhcp6_client(client, "Ignoring %zu invalid byte(s) at the end of the packet", len - offset);
break;
}
r = dhcp6_option_parse(message->options, len, &offset, &optcode, &optlen, &optval);
if (r < 0)
return log_dhcp6_client_errno(client, r,

View File

@ -461,6 +461,8 @@ TEST(client_parse_message_issue_24002) {
0x20, 0x03, 0x00, 0xff, 0xaa, 0xbb, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* prefix */
/* Rapid commit */
0x00, 0x0e, 0x00, 0x00,
/* Trailing invalid byte at the end. See issue #28183. */
00,
};
static const uint8_t duid[] = {
0x00, 0x00, 0xab, 0x11, 0x5c, 0x6b, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,