mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 12:13:47 +00:00
Add assertion that netif index is within sane range in sockets.h.
We can assert here since lwIP only supports <= 255 netifs due to netif index being an u8_t.
This commit is contained in:
parent
fa51a7225a
commit
b9d3812ee8
@ -3187,6 +3187,7 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
|
|||||||
const struct ipv6_mreq *imr = (const struct ipv6_mreq *)optval;
|
const struct ipv6_mreq *imr = (const struct ipv6_mreq *)optval;
|
||||||
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, optlen, struct ipv6_mreq, NETCONN_UDP);
|
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, optlen, struct ipv6_mreq, NETCONN_UDP);
|
||||||
inet6_addr_to_ip6addr(&multi_addr, &imr->ipv6mr_multiaddr);
|
inet6_addr_to_ip6addr(&multi_addr, &imr->ipv6mr_multiaddr);
|
||||||
|
LWIP_ASSERT("Invalid netif index", imr->ipv6mr_interface <= 0xFFu);
|
||||||
netif = netif_get_by_index((u8_t)imr->ipv6mr_interface);
|
netif = netif_get_by_index((u8_t)imr->ipv6mr_interface);
|
||||||
if (netif == NULL) {
|
if (netif == NULL) {
|
||||||
err = EADDRNOTAVAIL;
|
err = EADDRNOTAVAIL;
|
||||||
|
Loading…
Reference in New Issue
Block a user