From bb411b952d6c70dc93de22aa3d092e385239de6c Mon Sep 17 00:00:00 2001 From: Chaitanya Babu Talluri Date: Fri, 8 Mar 2019 12:45:50 +0000 Subject: [PATCH] cfgfile: replace strcat with strlcat Replace strcat with strlcat to avoid buffer overflow. Fixes: a6a47ac9c2 ("cfgfile: rework load function") Cc: stable@dpdk.org Signed-off-by: Chaitanya Babu Talluri Acked-by: Ferruh Yigit --- lib/librte_cfgfile/rte_cfgfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index 6110dba76b..f8e7627a51 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -224,10 +224,11 @@ rte_cfgfile_load_with_params(const char *filename, int flags, _strip(split[1], strlen(split[1])); char *end = memchr(split[1], '\\', strlen(split[1])); + size_t split_len = strlen(split[1]) + 1; while (end != NULL) { if (*(end+1) == params->comment_character) { *end = '\0'; - strcat(split[1], end+1); + strlcat(split[1], end+1, split_len); } else end++; end = memchr(end, '\\', strlen(end)); -- 2.20.1