Add to check symbolic link before using filepath(+w) 17/145817/2
authorJiyong Min <jiyong.min@samsung.com>
Thu, 24 Aug 2017 04:15:03 +0000 (13:15 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Thu, 24 Aug 2017 05:11:52 +0000 (14:11 +0900)
Change-Id: Iebe5b0c25143cd1be48300201d15c7f9a1b57440
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
packaging/media-server.spec
src/common/media-common-external-storage.c
src/server/media-server-main.c

index 4567905..ce6864e 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       media-server
 Summary:    A server for media content management
-Version:    0.3.50
+Version:    0.3.51
 Release:    0
 Group:      Multimedia/Service
 License:    Apache-2.0
index acabd26..20c71cf 100755 (executable)
@@ -289,6 +289,11 @@ int ms_write_device_info(const char *root_path, char *device_uuid)
 
        path[len] = '\0';
 
+       if (g_file_test(path, G_FILE_TEST_IS_SYMLINK)) {
+               MS_DBG_ERR("path is symbolic link. file name : %s", path);
+               return MS_MEDIA_ERR_INVALID_PATH;
+       }
+
        fp = fopen(path, "wt");
        if (fp == NULL) {
                MS_DBG_ERR("fp is NULL. file name : %s", path);
index 28294a8..17517c7 100755 (executable)
@@ -253,6 +253,11 @@ int ms_write_media_server_status(void)
        const char *path = "/tmp/media-server";
        const char *status = "MEDIA_SERVER OK";
 
+       if (g_file_test(path, G_FILE_TEST_IS_SYMLINK)) {
+               MS_DBG_ERR("path is symbolic link. file name : %s", path);
+               return MS_MEDIA_ERR_INVALID_PATH;
+       }
+
        fp = fopen(path, "wt");
        if (fp == NULL) {
                MS_DBG_ERR("fp is NULL. file name : %s", path);