feature: fix feature config data initialization overflow
Copy only exactly the data provided by the user even when it is not a 4-bytes multiple. Type: fix Change-Id: I2ef987c37e58523a38b46b09227529db2c26aa55 Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit c79a14f13a0db6f59123e0e6b0b71d4f24433b01)
This commit is contained in:
parent
76797dc615
commit
cafaac98e7
@ -267,11 +267,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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user