summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2021-01-19 23:09:51 -0800
committerSteven Luong <sluong@cisco.com>2021-01-19 23:14:42 -0800
commit7f1d780f0be6e176bd19809c2d733e7ebd0007c4 (patch)
tree081b92ed79c73dca93e30173dc6abc61ce46fd87 /src
parent533ac64330436752f82477973e4587e2197c4719 (diff)
classify: crash on classify filter pcap del command
If classify pcap filter was never configured, typing the delete command causes a crash. The reason is cm->classify_table_index_by_sw_if_index not yet allocated. The fix is to add a check before we access the vector. Type: fix Fixes: gerrit 28475 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ia33bd91fa82d8ffc4490d4069155980a6e233268
Diffstat (limited to 'src')
-rw-r--r--src/vnet/classify/vnet_classify.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c
index 7e239cc57a7..ca34eecc77f 100644
--- a/src/vnet/classify/vnet_classify.c
+++ b/src/vnet/classify/vnet_classify.c
@@ -1786,7 +1786,8 @@ classify_set_pcap_chain (vnet_classify_main_t * cm,
* Put the table index where device drivers can find them.
* This table index will be either a valid table or a ~0 to clear it.
*/
- cm->classify_table_index_by_sw_if_index[sw_if_index] = table_index;
+ if (vec_len (cm->classify_table_index_by_sw_if_index) > sw_if_index)
+ cm->classify_table_index_by_sw_if_index[sw_if_index] = table_index;
if (sw_if_index > 0)
{
vnet_hw_interface_t *hi;