mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-27 03:35:38 +00:00
bridgeif: sanity-check init_data->max_ports <= BRIDGEIF_MAX_PORTS
This commit is contained in:
parent
77df9ccd5a
commit
9c78909857
@ -69,6 +69,8 @@
|
||||
/** BRIDGEIF_MAX_PORTS: this is used to create a typedef used for forwarding
|
||||
* bit-fields: the number of bits required is this + 1 (for the internal/cpu port)
|
||||
* (63 is the maximum, resulting in an u64_t for the bit mask)
|
||||
* ATTENTION: this controls the maximum number of the implementation only!
|
||||
* The max. number of ports per bridge must still be passed via netif_add parameter!
|
||||
*/
|
||||
#ifndef BRIDGEIF_MAX_PORTS
|
||||
#define BRIDGEIF_MAX_PORTS 7
|
||||
|
@ -608,6 +608,8 @@ bridgeif_init(struct netif *netif)
|
||||
|
||||
init_data = (bridgeif_initdata_t *)netif->state;
|
||||
LWIP_ASSERT("init_data != NULL", (init_data != NULL));
|
||||
LWIP_ASSERT("init_data->max_ports <= BRIDGEIF_MAX_PORTS",
|
||||
init_data->max_ports <= BRIDGEIF_MAX_PORTS);
|
||||
|
||||
alloc_len = sizeof(bridgeif_private_t) + (init_data->max_ports*sizeof(bridgeif_port_t) + (init_data->max_fdb_static_entries*sizeof(bridgeif_fdb_static_entry_t)));
|
||||
LWIP_DEBUGF(BRIDGEIF_DEBUG, ("bridgeif_init: allocating %d bytes for private data\n", (int)alloc_len));
|
||||
|
Loading…
x
Reference in New Issue
Block a user