fix svace issue 30/304030/2
authorsamsung2013 <yuzhi.he@samsung.com>
Tue, 9 Jan 2024 07:40:02 +0000 (15:40 +0800)
committersamsung2013 <yuzhi.he@samsung.com>
Tue, 9 Jan 2024 08:05:11 +0000 (16:05 +0800)
Change-Id: If7c0269e6dd00b6b7ef8c0ad91c2641bf5a8d9c1

src/media_content.c

index f9b7b8d..2490748 100644 (file)
@@ -399,9 +399,7 @@ bool _is_mounted(const char *dir_path)
        const char *table = "/etc/mtab";
        FILE *fp;
 
-       strcpy(root_path, tzplatform_getenv(TZ_SYS_STORAGE));
-       strcat(root_path, "/USBDrive");
-
+       snprintf(root_path, MAX_PATH_LEN, "%s%s", tzplatform_getenv(TZ_SYS_STORAGE), "/USBDrive");
        if (!g_str_has_prefix(dir_path, root_path))
                return true;
 
@@ -409,7 +407,7 @@ bool _is_mounted(const char *dir_path)
        if(p && p - dir_path < MAX_PATH_LEN)
                strncpy(mount_path, dir_path, p - dir_path);
        else
-               strcpy(mount_path, dir_path);
+               snprintf(mount_path, MAX_PATH_LEN, "%s", dir_path);
 
        fp = setmntent(table, "r");
        if (!fp) {
@@ -424,7 +422,7 @@ bool _is_mounted(const char *dir_path)
        }
        endmntent(fp);
 
-       content_info("dir_path[%s] mount_path[%s] ret[%d]", dir_path, mount_path, ret);
+       content_error("[NO ERROR] dir_path[%s] mount_path[%s] ret[%d]", dir_path, mount_path, ret);
        return ret;
 }