emulator: tighten validation for conf file
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 25 Oct 2016 04:53:16 +0000 (13:53 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 25 Oct 2016 04:58:09 +0000 (13:58 +0900)
Change-Id: Iaae354e0815a568a7685d430959e60f8e5b424b9
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
tizen/src/emulator_options.c

index 209bbab..03ea020 100644 (file)
@@ -220,7 +220,12 @@ bool load_conf(const char * const conf)
 
     assert(!!conf);
     filename = g_strdup(conf);
-    file = fopen(filename, "r");
+    if(!g_file_test(filename, G_FILE_TEST_IS_REGULAR)) {
+        fprintf(stderr,
+            "Profile configuration file [%s] is invalid.\n", filename);
+        return false;
+    }
+    file = g_fopen(filename, "r");
     if (!file) {
         fprintf(stderr,
             "Profile configuration file [%s] is not found.\n", filename);