From 42c2a6a8199bc84a65cd7eb758772f360db5ed8b Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Tue, 17 Apr 2018 14:42:27 +0100 Subject: [PATCH] mem: use strlcpy instead of snprintf Signed-off-by: Anatoly Burakov Acked-by: Bruce Richardson --- lib/librte_eal/common/eal_common_memalloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/eal_common_memalloc.c b/lib/librte_eal/common/eal_common_memalloc.c index 49fd53c689..e9836889b8 100644 --- a/lib/librte_eal/common/eal_common_memalloc.c +++ b/lib/librte_eal/common/eal_common_memalloc.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "eal_private.h" @@ -179,7 +180,7 @@ eal_memalloc_mem_event_callback_register(const char *name, /* callback successfully created and is valid, add it to the list */ entry->clb = clb; - snprintf(entry->name, RTE_MEM_EVENT_CALLBACK_NAME_LEN, "%s", name); + strlcpy(entry->name, name, RTE_MEM_EVENT_CALLBACK_NAME_LEN); TAILQ_INSERT_TAIL(&mem_event_callback_list, entry, next); ret = 0; @@ -284,7 +285,7 @@ eal_memalloc_mem_alloc_validator_register(const char *name, entry->clb = clb; entry->socket_id = socket_id; entry->limit = limit; - snprintf(entry->name, RTE_MEM_ALLOC_VALIDATOR_NAME_LEN, "%s", name); + strlcpy(entry->name, name, RTE_MEM_ALLOC_VALIDATOR_NAME_LEN); TAILQ_INSERT_TAIL(&mem_alloc_validator_list, entry, next); ret = 0; -- 2.20.1