Skip to content

Commit 78681de

Browse files
mgsmith1000dmarion
authored andcommitted
l2: fix null deref in l2_to_bvi()
Type: fix Static analysis identified a possible null pointer dereference. It was introduced by a recent patch which expanded the DMAC comparison on inbound packets on a BVI interface to include any secondary MAC addresses which were added to an interface. Check if the pointer is null before dereferencing. Change-Id: Ic2afe2b062eda32977e05bf3f98d82c1fe64620c Signed-off-by: Matthew Smith <mgsmith@netgate.com>
1 parent 730cec8 commit 78681de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/vnet/l2/l2_bvi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ l2_to_bvi (vlib_main_t * vlib_main,
7272
ethernet_interface_t *ei = ethernet_get_interface (em, hi->hw_if_index);
7373
u32 rv;
7474

75-
if (PREDICT_FALSE (vec_len (ei->secondary_addrs) > 0))
75+
if (PREDICT_FALSE (ei && (vec_len (ei->secondary_addrs) > 0)))
7676
rv = l2_to_bvi_dmac_check (hi, e0->dst_address, ei,
7777
1 /* have_sec_dmac */ );
7878
else

0 commit comments

Comments
 (0)