0623codex

Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
Mupceet 2022-06-23 18:11:51 +08:00
parent ab0b3090b0
commit e240119103
4 changed files with 22 additions and 18 deletions

View File

@ -49,15 +49,18 @@ static int StartProcess(const char *name, const char *extArgv[], int extArgc)
}
if (strncat_s(nameValue, len, name, strlen(name)) != 0) {
BEGET_LOGE("Failed strncat_s name err=%d", errno);
free(nameValue);
return -1;
}
for (int j = 0; j < extArgc; j++) {
if (strncat_s(nameValue, len, "|", 1) != 0) {
BEGET_LOGE("Failed strncat_s \"|\"err=%d", errno);
free(nameValue);
return -1;
}
if (strncat_s(nameValue, len, extArgv[j], strlen(extArgv[j])) != 0) {
BEGET_LOGE("Failed strncat_s err=%d", errno);
free(nameValue);
return -1;
}
}

View File

@ -175,6 +175,7 @@ static void BShellEnvParseParam(BShellEnv *shell)
quotes = quotes ? 0 : 1;
}
if (record == 1) {
BSH_CHECK(shell->argc < BSH_PARAMETER_MAX_NUMBER, return, "argc out of range");
shell->args[shell->argc++] = shell->buffer + i;
record = 0;
}

View File

@ -76,9 +76,9 @@ static void DumpServiceSocket(const Service *service)
ServiceSocket *sockopt = service->socketCfg;
while (sockopt != NULL) {
printf("\t\tsocket name: %s \n", sockopt->name);
printf("\t\tsocket type: %d \n", sockopt->type);
printf("\t\tsocket uid: %d \n", sockopt->uid);
printf("\t\tsocket gid: %d \n", sockopt->gid);
printf("\t\tsocket type: %u \n", sockopt->type);
printf("\t\tsocket uid: %u \n", sockopt->uid);
printf("\t\tsocket gid: %u \n", sockopt->gid);
sockopt = sockopt->next;
}
}
@ -100,11 +100,11 @@ void DumpOneService(const Service *service)
#endif
printf("\tservice pid: [%d] \n", service->pid);
printf("\tservice crashCnt: [%d] \n", service->crashCnt);
printf("\tservice attribute: [%d] \n", service->attribute);
printf("\tservice attribute: [%u] \n", service->attribute);
printf("\tservice importance: [%d] \n", service->importance);
printf("\tservice startMode: [%s] \n", startModeMap[service->status].name);
printf("\tservice status: [%s] \n", statusMap[service->status].name);
printf("\tservice perms uID [%d] \n", service->servPerm.uID);
printf("\tservice perms uID [%u] \n", service->servPerm.uID);
DumpServiceArgs("path arg", &service->pathArgs);
DumpServiceArgs("writepid file", &service->writePidArgs);
DumpServiceJobs(service);
@ -112,11 +112,11 @@ void DumpOneService(const Service *service)
printf("\tservice perms groupId %d \n", service->servPerm.gIDCnt);
for (int i = 0; i < service->servPerm.gIDCnt; i++) {
printf("\t\tservice perms groupId %d \n", service->servPerm.gIDArray[i]);
printf("\t\tservice perms groupId %u \n", service->servPerm.gIDArray[i]);
}
printf("\tservice perms capability %d \n", service->servPerm.capsCnt);
printf("\tservice perms capability %u \n", service->servPerm.capsCnt);
for (int i = 0; i < (int)service->servPerm.capsCnt; i++) {
printf("\t\tservice perms capability %d \n", service->servPerm.caps[i]);
printf("\t\tservice perms capability %u \n", service->servPerm.caps[i]);
}
}

View File

@ -122,21 +122,21 @@ static int DumpTrieDataNodeTraversal(const WorkSpace *workSpace, const ParamTrie
return 0;
}
if (verbose) {
PARAM_DUMP("\tTrie node info [%u,%u,%u] data: %u label: %u key length:%d \n\t key: %s \n",
PARAM_DUMP("\tTrie node info [%u,%u,%u] data: %u label: %u key length:%u \n\t key: %s \n",
current->left, current->right, current->child,
current->dataIndex, current->labelIndex, current->length, current->key);
}
if (current->dataIndex != 0) {
ParamNode *entry = (ParamNode *)GetTrieNode(workSpace, current->dataIndex);
if (entry != NULL) {
PARAM_DUMP("\tparameter length info [%d, %d] \n\t param: %s \n",
PARAM_DUMP("\tparameter length info [%u, %u] \n\t param: %s \n",
entry->keyLength, entry->valueLength, (entry != NULL) ? entry->data : "null");
}
}
if (current->labelIndex != 0 && verbose) {
ParamSecurityNode *label = (ParamSecurityNode *)GetTrieNode(workSpace, current->labelIndex);
if (label != NULL) {
PARAM_DUMP("\tparameter label dac %d %d %o \n\t label: %s \n",
PARAM_DUMP("\tparameter label dac %u %u %o \n\t label: %s \n",
label->uid, label->gid, label->mode, (label->length > 0) ? label->data : "null");
}
}
@ -147,12 +147,12 @@ static void HashNodeTraverseForDump(WorkSpace *workSpace, int verbose)
{
PARAM_DUMP(" map file: %s \n", workSpace->fileName);
if (workSpace->area != NULL) {
PARAM_DUMP(" total size: %d \n", workSpace->area->dataSize);
PARAM_DUMP(" first offset: %d \n", workSpace->area->firstNode);
PARAM_DUMP(" current offset: %d \n", workSpace->area->currOffset);
PARAM_DUMP(" total node: %d \n", workSpace->area->trieNodeCount);
PARAM_DUMP(" total param node: %d \n", workSpace->area->paramNodeCount);
PARAM_DUMP(" total security node: %d\n", workSpace->area->securityNodeCount);
PARAM_DUMP(" total size: %u \n", workSpace->area->dataSize);
PARAM_DUMP(" first offset: %u \n", workSpace->area->firstNode);
PARAM_DUMP(" current offset: %u \n", workSpace->area->currOffset);
PARAM_DUMP(" total node: %u \n", workSpace->area->trieNodeCount);
PARAM_DUMP(" total param node: %u \n", workSpace->area->paramNodeCount);
PARAM_DUMP(" total security node: %u\n", workSpace->area->securityNodeCount);
}
PARAM_DUMP(" node info: \n");
PARAMSPACE_AREA_RD_LOCK(workSpace);
@ -174,7 +174,7 @@ void SystemDumpParameters(int verbose)
PARAM_DUMP("Dump all parameters begin ...\n");
if (verbose) {
PARAM_DUMP("Local sercurity information\n");
PARAM_DUMP("\t pid: %d uid: %d gid: %d \n",
PARAM_DUMP("\t pid: %d uid: %u gid: %u \n",
paramSpace->securityLabel.cred.pid,
paramSpace->securityLabel.cred.uid,
paramSpace->securityLabel.cred.gid);