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:
@@ -1744,6 +1744,10 @@ netif_find(const char *name)
|
||||
}
|
||||
|
||||
num = (u8_t)atoi(&name[2]);
|
||||
if (!num && (name[2] != 0)) {
|
||||
/* this means atoi has failed */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NETIF_FOREACH(netif) {
|
||||
if (num == netif->num &&
|
||||
|
||||
Reference in New Issue
Block a user