aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/config.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/vnet/config.c b/src/vnet/config.c
index 59375746af5..4e9fa36dfc3 100644
--- a/src/vnet/config.c
+++ b/src/vnet/config.c
@@ -331,11 +331,16 @@ vnet_config_add_feature (vlib_main_t * vm,
f->feature_index = feature_index;
f->node_index = node_index;
- n_feature_config_u32s =
- round_pow2 (n_feature_config_bytes,
- sizeof (f->feature_config[0])) /
- sizeof (f->feature_config[0]);
- vec_add (f->feature_config, feature_config, n_feature_config_u32s);
+ if (n_feature_config_bytes)
+ {
+ n_feature_config_u32s =
+ round_pow2 (n_feature_config_bytes,
+ sizeof (f->feature_config[0])) /
+ sizeof (f->feature_config[0]);
+ vec_validate (f->feature_config, n_feature_config_u32s - 1);
+ clib_memcpy_fast (f->feature_config, feature_config,
+ n_feature_config_bytes);
+ }
/* Sort (prioritize) features. */
if (vec_len (new_features) > 1)