sd-dhcp-server: refuse too large packet to send

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44134.
This commit is contained in:
Yu Watanabe
2022-01-28 11:53:49 +09:00
committed by Luca Boccassi
parent a663f5eef5
commit 71df50a973
2 changed files with 3 additions and 0 deletions

View File

@@ -319,6 +319,9 @@ static int dhcp_server_send_unicast_raw(
memcpy(link.ll.sll_addr, chaddr, hlen);
if (len > UINT16_MAX)
return -EOVERFLOW;
dhcp_packet_append_ip_headers(packet, server->address, DHCP_PORT_SERVER,
packet->dhcp.yiaddr,
DHCP_PORT_CLIENT, len, -1);