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 <tallurix.chaitanya.babu@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Chaitanya Babu Talluri 2019-03-08 12:45:50 +00:00 committed by Thomas Monjalon
parent 560a3580ba
commit bb411b952d

View File

@ -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));