Sanity-check the size of netif->hwaddr

This commit is contained in:
goldsimon 2012-08-13 20:57:19 +02:00
parent b56a1501d2
commit c69914367d

View File

@ -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); ip_addr_set_zero(&dhcp->msg_out->giaddr);
for (i = 0; i < DHCP_CHADDR_LEN; i++) { for (i = 0; i < DHCP_CHADDR_LEN; i++) {
/* copy netif hardware address, pad with zeroes */ /* 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++) { for (i = 0; i < DHCP_SNAME_LEN; i++) {
dhcp->msg_out->sname[i] = 0; dhcp->msg_out->sname[i] = 0;