Fix build error when applying new toolchain 59/222859/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 21 Jan 2020 02:06:59 +0000 (11:06 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 21 Jan 2020 02:06:59 +0000 (11:06 +0900)
Change-Id: I6ca6d6122bbe91c379bb73e908c4530e611f47dc
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/pkg_cmd.c

index a9423c8..baff1d3 100644 (file)
@@ -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");