From 44b92d9254d3558ad7abaad3b6d231cd7bb69d22 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 5 Mar 2022 15:47:04 +0800 Subject: [PATCH] Fix readline_common.c:277:19: error: 'strncpy' destination unchanged after copying no bytes Signed-off-by: Xiang Xiao --- system/readline/readline_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/readline/readline_common.c b/system/readline/readline_common.c index 6fdf9b502..4ddfe2802 100644 --- a/system/readline/readline_common.c +++ b/system/readline/readline_common.c @@ -274,7 +274,7 @@ static void tab_completion(FAR struct rl_common_s *vtbl, char *buf, if (tmp_name[0] == '\0') { - strncpy(tmp_name, name, sizeof(tmp_name) - 1); + strlcpy(tmp_name, name, sizeof(tmp_name)); } RL_PUTC(vtbl, ' '); @@ -309,7 +309,7 @@ static void tab_completion(FAR struct rl_common_s *vtbl, char *buf, if (tmp_name[0] == '\0') { - strncpy(tmp_name, name, sizeof(tmp_name) - 1); + strlcpy(tmp_name, name, sizeof(tmp_name)); } RL_PUTC(vtbl, ' ');