fix svace issue 79/304679/1 accepted/tizen/8.0/unified/20240123.170045
authorsamsung2013 <yuzhi.he@samsung.com>
Tue, 9 Jan 2024 07:40:02 +0000 (15:40 +0800)
committeryuzhi He <yuzhi.he@samsung.com>
Tue, 23 Jan 2024 05:36:32 +0000 (05:36 +0000)
Change-Id: If7c0269e6dd00b6b7ef8c0ad91c2641bf5a8d9c1
(cherry picked from commit 264d9d47d5710c82c4f605cc6fbb175066f74aa2)

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;
 }