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:
Simon Goldschmidt 2019-12-11 20:42:36 +01:00
parent fbe032d05d
commit 4528215c99

View File

@ -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 &&