From e5475346034f6d001750932dfc4de30b3c121ac0 Mon Sep 17 00:00:00 2001 From: Kichan Kwon Date: Mon, 28 Mar 2016 15:21:06 +0900 Subject: [PATCH] Set max reading length Change-Id: Ic23e693c62bcd81f2a8619986f52111c97c97b41 Signed-off-by: Kichan Kwon --- src/heart/decision-memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/heart/decision-memory.c b/src/heart/decision-memory.c index b6033c0..39ce772 100644 --- a/src/heart/decision-memory.c +++ b/src/heart/decision-memory.c @@ -208,11 +208,13 @@ static void decision_memory_updated_cb(char *data) struct decision_item *di; unsigned pss, uss; int time, len; + char format[32]; if (!data) return; - len = sscanf(data, "%s %s %d %u %u", appid, pkgname, &time, &pss, &uss); + snprintf(format, 32, "%%%ds %%%ds %%d %%u %%u", MAX_APPID_LENGTH, MAX_PKGNAME_LENGTH); + len = sscanf(data, format, appid, pkgname, &time, &pss, &uss); if (len < 0) { _E("sscanf failed"); return; -- 2.7.4