diff options
author | Michal Cmarada <mcmarada@cisco.com> | 2019-01-18 12:51:08 +0100 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-01-20 15:22:18 +0000 |
commit | e67c1d8242fec255e7449fedcbdec5c66bb3f7b2 (patch) | |
tree | 69391717175d4db028e676241c035a0a0b8740ea /src | |
parent | 34321b3445b77f2624475d18a6483db6fd0d7e94 (diff) |
fix data_length in IpSec API call (VPP-1548)
Change-Id: Idb2839f6082bd2e052be2bc5417f0ebb43d1c0a6
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/ipsec/ipsec_api.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vnet/ipsec/ipsec_api.c b/src/vnet/ipsec/ipsec_api.c index 59fb868f878..fc09f77db6c 100644 --- a/src/vnet/ipsec/ipsec_api.c +++ b/src/vnet/ipsec/ipsec_api.c @@ -717,9 +717,10 @@ static void #if WITH_LIBSSL > 0 vlib_main_t *vm = vlib_get_main (); clib_error_t *error; + int data_len = ntohl (mp->data_len); u8 *tmp = format (0, "%s", mp->name); - u8 *data = vec_new (u8, mp->data_len); - clib_memcpy (data, mp->data, mp->data_len); + u8 *data = vec_new (u8, data_len); + clib_memcpy (data, mp->data, data_len); error = ikev2_set_profile_auth (vm, tmp, mp->auth_method, data, mp->is_hex); vec_free (tmp); vec_free (data); @@ -742,8 +743,9 @@ vl_api_ikev2_profile_set_id_t_handler (vl_api_ikev2_profile_set_id_t * mp) vlib_main_t *vm = vlib_get_main (); clib_error_t *error; u8 *tmp = format (0, "%s", mp->name); - u8 *data = vec_new (u8, mp->data_len); - clib_memcpy (data, mp->data, mp->data_len); + int data_len = ntohl (mp->data_len); + u8 *data = vec_new (u8, data_len); + clib_memcpy (data, mp->data, data_len); error = ikev2_set_profile_id (vm, tmp, mp->id_type, data, mp->is_local); vec_free (tmp); vec_free (data); |