mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-18 20:10:53 +00:00
netif_find: check if atoi means '0' or error
Since atoi() returns 0 on error, we need to check if name[2] is '0'. If it's not, atoi() failed.
This commit is contained in:
parent
02ab8c91a9
commit
2f8886794f
@ -1714,6 +1714,10 @@ netif_find(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
num = (u8_t)atoi(&name[2]);
|
num = (u8_t)atoi(&name[2]);
|
||||||
|
if (!num && (name[2] != 0)) {
|
||||||
|
/* this means atoi has failed */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
NETIF_FOREACH(netif) {
|
NETIF_FOREACH(netif) {
|
||||||
if (num == netif->num &&
|
if (num == netif->num &&
|
||||||
|
Loading…
Reference in New Issue
Block a user