tests: net: tx_timestamp: Check max number of interfaces

Add checks so that we do not overflow the network interface
array.

Fixes #8715

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen
2018-07-04 14:35:29 +03:00
parent 8a74e7056d
commit b4dae00741

View File

@@ -323,6 +323,11 @@ static void iface_cb(struct net_if *iface, void *user_data)
net_if_get_by_iface(iface));
if (net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET)) {
if (ud->eth_if_count >= ARRAY_SIZE(eth_interfaces)) {
DBG("Invalid interface %p\n", iface);
return;
}
eth_interfaces[ud->eth_if_count++] = iface;
}