From 94cf9a17d066b571df48786ba27d7da200bad148 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 4 Jan 2022 15:13:15 +0900 Subject: [PATCH] Fix static analysis issue Change to check destination path's size of strncpy Change-Id: Iad8a0f0fb7ca7777e663cb2f058975473fd0ee2e Signed-off-by: Ilho Kim --- src/pkgcmd/delta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pkgcmd/delta.c b/src/pkgcmd/delta.c index ac572fe..aabfe01 100644 --- a/src/pkgcmd/delta.c +++ b/src/pkgcmd/delta.c @@ -70,7 +70,7 @@ static GList *__list_directory(const char *dir_name, const char *tpk_path, GList if (!(file_info->d_type & DT_DIR)) { snprintf(rel_path_old_tpk_file, PATH_MAX, "%s/%s", dir_name, d_name); strncpy(path, rel_path_old_tpk_file + strlen(tpk_path), - strlen(rel_path_old_tpk_file)); + sizeof(path) - 1); file_path = strndup(path, sizeof(path)); list = g_list_append(list, file_path); memset(path, 0, PATH_MAX); -- 2.34.1