From: Junghyun Yeon Date: Tue, 21 Jan 2020 02:06:59 +0000 (+0900) Subject: Fix build error when applying new toolchain X-Git-Tag: submit/tizen/20200121.023415~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a41a6b5069200c9930043d10d7d366087affae2;p=platform%2Fcore%2Fappfw%2Fpkgmgr-tool.git Fix build error when applying new toolchain Change-Id: I6ca6d6122bbe91c379bb73e908c4530e611f47dc Signed-off-by: Junghyun Yeon --- diff --git a/src/pkg_cmd.c b/src/pkg_cmd.c index a9423c8..baff1d3 100644 --- a/src/pkg_cmd.c +++ b/src/pkg_cmd.c @@ -293,7 +293,11 @@ static int __convert_to_absolute_path(pm_tool_args *data) printf("path is NULL\n"); return -1; } - strncpy(temp, data->pkg_path, sizeof(temp) - 1); + ret = snprintf(temp, PATH_MAX - 1, "%s", data->pkg_path); + if (ret < 0 || ret > PATH_MAX - 1) { + printf("snprintf fail\n"); + return -1; + } if (strchr(data->pkg_path, '/') == NULL) { if (getcwd(abs, PKG_NAME_STRING_LEN_MAX - 1) == NULL) { printf("getcwd() failed\n"); @@ -337,7 +341,11 @@ static int __convert_to_absolute_tep_path(pm_tool_args *data) printf("path is NULL\n"); return -1; } - strncpy(temp, data->tep_path, sizeof(temp) - 1); + ret = snprintf(temp, PATH_MAX - 1, "%s", data->tep_path); + if (ret < 0 || ret > PATH_MAX - 1) { + printf("snprintf fail\n"); + return -1; + } if (strchr(data->tep_path, '/') == NULL) { if (getcwd(abs, PATH_MAX - 1) == NULL || abs[0] == '\0') { printf("getcwd() failed\n");