mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 23:29:25 +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
|
||||
/* DNS servers */
|
||||
n = 0;
|
||||
while(dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n) && (n < DNS_MAX_SERVERS)) {
|
||||
for(n = 0; (n < DNS_MAX_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n); n++) {
|
||||
ip_addr_t dns_addr;
|
||||
ip4_addr_set_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)));
|
||||
dns_setserver(n, &dns_addr);
|
||||
n++;
|
||||
}
|
||||
#endif /* LWIP_DNS */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user