aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ipsec_cli.c
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2018-11-26 09:29:00 +0100
committerDamjan Marion <dmarion@me.com>2018-11-26 19:53:18 +0000
commit6221927e9bad39c2856e844f8bc38947cb447f73 (patch)
tree74679586c0c01819b4ec5ba60a796baa3b69c72d /src/vnet/ipsec/ipsec_cli.c
parenta25def7807fb46bd48462be3ec5c598fc79e2a13 (diff)
Fix IPSec CLI key parsing
strncpy stops copying when a byte set to 0 is read. The fix is to use mempcy instead. This patch also adds spd id to ipsec input trace. Change-Id: Ibed071d3607fa76c3f6ee065f94128f1aca9b2e2 Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'src/vnet/ipsec/ipsec_cli.c')
-rw-r--r--src/vnet/ipsec/ipsec_cli.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vnet/ipsec/ipsec_cli.c b/src/vnet/ipsec/ipsec_cli.c
index ee7dd404a87..9c64822c37f 100644
--- a/src/vnet/ipsec/ipsec_cli.c
+++ b/src/vnet/ipsec/ipsec_cli.c
@@ -167,10 +167,10 @@ ipsec_sa_add_del_command_fn (vlib_main_t * vm,
sa.integ_key_len = sizeof (sa.integ_key);
if (ck)
- strncpy ((char *) sa.crypto_key, (char *) ck, sa.crypto_key_len);
+ memcpy (sa.crypto_key, ck, sa.crypto_key_len);
if (ik)
- strncpy ((char *) sa.integ_key, (char *) ik, sa.integ_key_len);
+ memcpy (sa.integ_key, ik, sa.integ_key_len);
if (is_add)
{