mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +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
fbe032d05d
commit
4528215c99
@ -1744,6 +1744,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