From 5266a81ea2b5d355916695c1ecc8c4570a54727b Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sun, 23 Feb 2014 17:30:13 +0100 Subject: sd-dhcp: use FIONREAD to get correct size of incoming DHCP packet This avoids the problem of broken DHCP servers sending us too big packets that don't fit in our buffer. --- src/libsystemd-dhcp/dhcp-packet.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libsystemd-dhcp/dhcp-packet.c') diff --git a/src/libsystemd-dhcp/dhcp-packet.c b/src/libsystemd-dhcp/dhcp-packet.c index 7c209fa658..8f9ec43c43 100644 --- a/src/libsystemd-dhcp/dhcp-packet.c +++ b/src/libsystemd-dhcp/dhcp-packet.c @@ -119,6 +119,8 @@ void dhcp_packet_append_ip_headers(DHCPPacket *packet, uint16_t len) { int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len) { size_t hdrlen; + assert(packet); + /* IP */ if (len < DHCP_IP_SIZE) { -- cgit v1.2.3-54-g00ecf