diff mbox

[OpenWrt-Devel,odhcpd] Limit size of IPv4 DHCP reply

Message ID 20150929155809.baf59539515985a1025eb1f4@ubnt.com
State Changes Requested
Headers show

Commit Message

Dmitry Ivanov Sept. 29, 2015, 12:58 p.m. UTC
Limit size of IPv4 DHCP reply.
In other words, remove zero padding after end option (0xff).

Signed-off-by: Dmitry Ivanov <dima@ubnt.com>
---
 src/dhcpv4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

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));
 }