未验证 提交 5d803abd 编写于 作者: O openharmony_ci 提交者: Gitee

!849 解决解析失败gid会导致提权问题

Merge pull request !849 from Mupceet/master_cc
...@@ -357,16 +357,17 @@ static int GetServiceGids(const cJSON *curArrItem, Service *curServ) ...@@ -357,16 +357,17 @@ static int GetServiceGids(const cJSON *curArrItem, Service *curServ)
curServ->servPerm.gIDArray[0] = gid; curServ->servPerm.gIDArray[0] = gid;
return SERVICE_SUCCESS; return SERVICE_SUCCESS;
} }
int gidArrayIndex = 0;
for (int i = 0; i < gidCount; ++i) { for (int i = 0; i < gidCount; ++i) {
cJSON *item = cJSON_GetArrayItem(arrItem, i); cJSON *item = cJSON_GetArrayItem(arrItem, i);
int ret = GetGid(item, &gid, curServ); int ret = GetGid(item, &gid, curServ);
if (ret != 0) { if (ret != 0) {
curServ->servPerm.gIDArray[i] = 0; INIT_LOGE("parse service %s %d gid failed skip this", curServ->name, i);
continue; continue;
} }
curServ->servPerm.gIDArray[i] = gid; curServ->servPerm.gIDArray[gidArrayIndex++] = gid;
} }
curServ->servPerm.gIDCnt = gidArrayIndex;
return SERVICE_SUCCESS; return SERVICE_SUCCESS;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册