emulator: string should null terminated 85/15685/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Thu, 23 Jan 2014 10:30:05 +0000 (19:30 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Mon, 27 Jan 2014 02:34:19 +0000 (11:34 +0900)
Change-Id: I4cb15d7f68856e19bb9399aa106358c40b876ad9
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/maruskin_server.c

index 63af17461709f20f342fceeb590109f1716d5b4b..6ee39968ae62167b2d5a77a0221945f18f54c389 100644 (file)
@@ -538,27 +538,16 @@ static void parse_skinconfig_prop(void)
         return;
     }
 
-    char* buf = g_malloc0(buf_size);
+    char* buf = g_malloc0(buf_size + 1);
     if (!buf) {
-        ERR("Fail to malloc for %s\n", SKIN_CONFIG_PROP);
+        ERR("Failed to malloc for %s\n", SKIN_CONFIG_PROP);
         fclose(fp);
         return;
     }
 
-    int read_cnt = 0;
-    int total_cnt = 0;
-
-    while (1) {
-        if (total_cnt == buf_size) {
-            break;
-        }
-
-        read_cnt = fread((void*) (buf + read_cnt), 1, buf_size - total_cnt, fp);
-        if (0 > read_cnt) {
-            break;
-        } else {
-            total_cnt += read_cnt;
-        }
+    int read_cnt = fread((void*) buf, 1, buf_size, fp);
+    if (buf_size > read_cnt) {
+        WARN("Failed to fread for %s\n", SKIN_CONFIG_PROP);
     }
 
     fclose(fp);