From 647c81fae89fb9bae9fdff59180faa649f3a1268 Mon Sep 17 00:00:00 2001 From: huangxiaolinabc123 Date: Mon, 30 Jan 2023 06:11:16 +0000 Subject: [PATCH] fixed 6382859 from https://gitee.com/du-zhihai/systemabilitymgr_samgr_lite/pulls/126 modify code Signed-off-by: huangxiaolinabc123 Change-Id: Ic53f759e11e6fc1e025909919af9d2a4db491c40 --- samgr_endpoint/source/endpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samgr_endpoint/source/endpoint.c b/samgr_endpoint/source/endpoint.c index b9af601..c78495c 100644 --- a/samgr_endpoint/source/endpoint.c +++ b/samgr_endpoint/source/endpoint.c @@ -44,6 +44,7 @@ #define MAX_REGISTER_RETRY_TIMES 10 #define REGISTER_RETRY_INTERVAL 2 #define MAX_POLICY_NUM 8 +#define MAX_SERVICE_POLICY_NUM 10000 #ifndef MAX_BUCKET_RATE #define MAX_BUCKET_RATE 1000 @@ -658,8 +659,8 @@ static void GetRemotePolicy(IpcIo *reply, PolicyTrans **policy, uint32 *policyNu static boolean JudgePolicy(uid_t callingUid, const PolicyTrans *policy, uint32 policyNum) { - if (policy == NULL) { - HILOG_ERROR(HILOG_MODULE_SAMGR, "Policy is NULL! Num is %u", policyNum); + if (policy == NULL || policyNum > MAX_SERVICE_POLICY_NUM) { + HILOG_ERROR(HILOG_MODULE_SAMGR, "Policy is NULL or policyNum is out of range! Num is %u", policyNum); return FALSE; } -- Gitee