diff options
author | Benoît Ganne <bganne@cisco.com> | 2021-02-12 16:25:07 +0100 |
---|---|---|
committer | Neale Ranns <neale@graphiant.com> | 2021-02-25 09:41:01 +0000 |
commit | 8b4d0dd5ba8ea42063b0700f39c2165486b8c9a0 (patch) | |
tree | a31829153d91edc63b4f3f4a24c533a0ebf35263 /src/plugins/linux-cp/lcp_api.c | |
parent | 7a29a2d400bbc3740a6a98863f290aa654d5f724 (diff) |
linux-cp: fix vector-used-a-C-string overflow
lip_host_name is a non-NULL terminated vector, not a NULL-terminated
C-string.
Type: fix
Change-Id: Ie5da59bc5680be72251904467d77b18263c882f8
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/linux-cp/lcp_api.c')
-rw-r--r-- | src/plugins/linux-cp/lcp_api.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/linux-cp/lcp_api.c b/src/plugins/linux-cp/lcp_api.c index 409aa7224af..a6e14a7cac7 100644 --- a/src/plugins/linux-cp/lcp_api.c +++ b/src/plugins/linux-cp/lcp_api.c @@ -120,9 +120,8 @@ send_lcp_itf_pair_details (index_t lipi, vl_api_registration_t *rp, rmp->vif_index = lcp_pair->lip_vif_index; rmp->host_if_type = api_encode_host_type (lcp_pair->lip_host_type); - clib_strncpy ((char *) rmp->host_if_name, - (char *) lcp_pair->lip_host_name, - vec_len (lcp_pair->lip_host_name) - 1); + memcpy_s (rmp->host_if_name, sizeof (rmp->host_if_name), + lcp_pair->lip_host_name, vec_len (lcp_pair->lip_host_name)); clib_strncpy ((char *) rmp->namespace, (char *) lcp_pair->lip_namespace, vec_len (lcp_pair->lip_namespace)); |