From c69914367da0c3859e01017516c3b197b11da3a7 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Mon, 13 Aug 2012 20:57:19 +0200 Subject: [PATCH] Sanity-check the size of netif->hwaddr --- src/core/dhcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/dhcp.c b/src/core/dhcp.c index 614fa324..2851d712 100644 --- a/src/core/dhcp.c +++ b/src/core/dhcp.c @@ -1693,7 +1693,7 @@ dhcp_create_msg(struct netif *netif, struct dhcp *dhcp, u8_t message_type) ip_addr_set_zero(&dhcp->msg_out->giaddr); for (i = 0; i < DHCP_CHADDR_LEN; i++) { /* copy netif hardware address, pad with zeroes */ - dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/; + dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len && i < NETIF_MAX_HWADDR_LEN) ? netif->hwaddr[i] : 0/* pad byte*/; } for (i = 0; i < DHCP_SNAME_LEN; i++) { dhcp->msg_out->sname[i] = 0;