[OpenWrt-Devel] [PATCH][odhcpd] Limit size of IPv4 DHCP reply
Dmitry Ivanov
dmitrijs.ivanovs at ubnt.com
Tue Sep 29 08:58:09 EDT 2015
Limit size of IPv4 DHCP reply.
In other words, remove zero padding after end option (0xff).
Signed-off-by: Dmitry Ivanov <dima at ubnt.com>
---
src/dhcpv4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index a657e13..c8014ea 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -497,7 +497,7 @@ static void handle_dhcpv4(void *addr, void *data, size_t len,
inet_ntoa(dest.sin_addr));
}
- sendto(sock, &reply, sizeof(reply), MSG_DONTWAIT,
+ sendto(sock, &reply, cookie - (uint8_t*) &reply - 1, MSG_DONTWAIT,
(struct sockaddr*)&dest, sizeof(dest));
}
--
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list