Resolve static analysis issue 45/222645/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 17 Jan 2020 02:24:05 +0000 (11:24 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 17 Jan 2020 02:24:05 +0000 (11:24 +0900)
Change-Id: If3eca9064e7a2de4e38dddad60af67302abf3cd8
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/pkg_cmd.c

index 99ed770..a9423c8 100644 (file)
@@ -293,7 +293,7 @@ static int __convert_to_absolute_path(pm_tool_args *data)
                printf("path is NULL\n");
                return -1;
        }
-       strncpy(temp, data->pkg_path, sizeof(temp));
+       strncpy(temp, data->pkg_path, sizeof(temp) - 1);
        if (strchr(data->pkg_path, '/') == NULL) {
                if (getcwd(abs, PKG_NAME_STRING_LEN_MAX - 1) == NULL) {
                        printf("getcwd() failed\n");
@@ -337,7 +337,7 @@ 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));
+       strncpy(temp, data->tep_path, sizeof(temp) - 1);
        if (strchr(data->tep_path, '/') == NULL) {
                if (getcwd(abs, PATH_MAX - 1) == NULL || abs[0] == '\0') {
                        printf("getcwd() failed\n");