mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 03:32:50 +00:00
dhcp: check array bounds before accessing it (bug #36170)
This commit is contained in:
parent
d690775ca1
commit
1704d21356
@ -567,12 +567,10 @@ dhcp_handle_ack(struct netif *netif)
|
|||||||
|
|
||||||
#if LWIP_DNS
|
#if LWIP_DNS
|
||||||
/* DNS servers */
|
/* DNS servers */
|
||||||
n = 0;
|
for(n = 0; (n < DNS_MAX_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n); n++) {
|
||||||
while(dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n) && (n < DNS_MAX_SERVERS)) {
|
|
||||||
ip_addr_t dns_addr;
|
ip_addr_t dns_addr;
|
||||||
ip4_addr_set_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)));
|
ip4_addr_set_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)));
|
||||||
dns_setserver(n, &dns_addr);
|
dns_setserver(n, &dns_addr);
|
||||||
n++;
|
|
||||||
}
|
}
|
||||||
#endif /* LWIP_DNS */
|
#endif /* LWIP_DNS */
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user