From: GiWoong Kim Date: Thu, 23 Jan 2014 10:30:05 +0000 (+0900) Subject: emulator: string should null terminated X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~504 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3ba60e320167efcb4a0166dff45c8dd41aa905a;p=sdk%2Femulator%2Fqemu.git emulator: string should null terminated Change-Id: I4cb15d7f68856e19bb9399aa106358c40b876ad9 Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/skin/maruskin_server.c b/tizen/src/skin/maruskin_server.c index 63af174617..6ee39968ae 100644 --- a/tizen/src/skin/maruskin_server.c +++ b/tizen/src/skin/maruskin_server.c @@ -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);