summaryrefslogtreecommitdiff
path: root/src/libsystemd-dhcp/dhcp-packet.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-23 17:30:13 +0100
committerTom Gundersen <teg@jklm.no>2014-02-23 17:52:31 +0100
commit5266a81ea2b5d355916695c1ecc8c4570a54727b (patch)
treebb56e464d908c6d9d1a12824b66fa248260fd3ba /src/libsystemd-dhcp/dhcp-packet.c
parent3bb621e1e66b704c0c2dcef31c66f7c646dd47f6 (diff)
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.
Diffstat (limited to 'src/libsystemd-dhcp/dhcp-packet.c')
-rw-r--r--src/libsystemd-dhcp/dhcp-packet.c2
1 files changed, 2 insertions, 0 deletions
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) {