From: jang Date: Thu, 24 Mar 2016 10:49:30 +0000 (+0900) Subject: fix defect reported by svace. X-Git-Tag: submit/tizen_mobile/20160324.110438^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=035a8e00da993b1ecee6e8fa69814fba5af5b401;p=platform%2Fcore%2Fapi%2Flibaccount-service.git fix defect reported by svace. Change-Id: I0a6dd52fecd7262a8d0f16a585e012d70d637bc2 Signed-off-by: jang --- diff --git a/src/account_offline.c b/src/account_offline.c index aa9ea2e..26a2c17 100644 --- a/src/account_offline.c +++ b/src/account_offline.c @@ -45,6 +45,7 @@ #define APP_GID 100 #define MIN_USER_UID 5000 +#define PW_BUF_LEN 4096 typedef sqlite3_stmt * account_stmt; @@ -343,7 +344,9 @@ ACCOUNT_INTERNAL_API int account_delete_from_db_by_package_name_offline(const ch uid_t uid = -1; uid_t gid = -1; int return_code = ACCOUNT_ERROR_NONE; + struct passwd pw; struct passwd *user_pw = NULL; + char buf[PW_BUF_LEN]; ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!")); @@ -355,7 +358,7 @@ ACCOUNT_INTERNAL_API int account_delete_from_db_by_package_name_offline(const ch } setpwent(); - while ((user_pw = getpwent()) != NULL) { + while (!getpwent_r(&pw, buf, PW_BUF_LEN, &user_pw)) { uid = user_pw->pw_uid; gid = user_pw->pw_gid; _INFO("user_pw->pw_uid=[%d], user_pw->pw_gid", uid, gid);