From f2c009c1543478d6442e547ebfa0358ed9e99a10 Mon Sep 17 00:00:00 2001 From: Yong Song Date: Tue, 13 Aug 2013 22:25:09 +0900 Subject: [PATCH] resolve prevent issues Change-Id: If826b2049f388367545401aa7ffd6bc2fab6ba8f --- appinfo/appinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appinfo/appinfo.c b/appinfo/appinfo.c index 999c14a..d3c0718 100644 --- a/appinfo/appinfo.c +++ b/appinfo/appinfo.c @@ -77,7 +77,7 @@ static const char* _execname = &INVALID_EXEC_NAME; int appinfo_init(const char* appid, int is_invalid_appid) { - if (!appid && strlen(appid) >= sizeof(__appid)) + if (!appid || (appid && strlen(appid) >= sizeof(__appid))) { return APP_INFO_ERROR_INVALID_ARG; } @@ -358,7 +358,7 @@ int appinfo_update_submode_execname_and_appid(const char* execname) } const size_t max_len = MAX_APPID - MAX_OSP_PKGID - 1; - const size_t size = MIN(strlen(execname), max_len); + const size_t size = MIN(strlen(execname) - 1, max_len - 1); strncpy(__appid + MAX_OSP_PKGID + 1, execname, size); __appid[size + MAX_OSP_PKGID + 1] = '\0'; -- 2.7.4