提交 d945e62b 编写于 作者: C cheng_jinsong

fix codex

Signed-off-by: Ncheng_jinsong <chengjinsong2@huawei.com>
Change-Id: Ic1f3fda7e93b6b4367edcc14a22a1e5ab564e082
上级 ac8e2135
......@@ -59,6 +59,9 @@ int GetParamValue(const char *symValue, unsigned int symLen, char *paramValue, u
int ret;
uint32_t curr = 0;
char *start = (char *)symValue;
if (symLen > strlen(symValue)) {
return -1;
}
char *end = (char *)symValue + symLen;
do {
char *begin = strchr(start, '$');
......
......@@ -168,9 +168,6 @@ static int InitCmd(int id, const char *name, int argc, const char **argv)
UNUSED(id);
// process cmd by name
PLUGIN_LOGI("InitCmd %s argc %d", name, argc);
for (int i = 0; i < argc; i++) {
PLUGIN_LOGI("InitCmd %s", argv[i]);
}
if (argc > 1 && strcmp(argv[0], "setloglevel") == 0) {
SetLogLevelFunc(argv[1]);
}
......
......@@ -14,6 +14,7 @@
*/
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include "param_manager.h"
#include "param_trie.h"
......@@ -144,7 +145,11 @@ static void CmdlineIterator(const NAME_VALUE_PAIR *nv, void *context)
continue;
}
}
snprintf_s(fullName, sizeof(fullName), sizeof(fullName) - 1, OHOS_CMDLINE_PARA_PREFIX "%s", cmdLines[i].name);
ret = snprintf_s(fullName, sizeof(fullName), sizeof(fullName) - 1,
OHOS_CMDLINE_PARA_PREFIX "%s", cmdLines[i].name);
if (ret <= 0) {
continue;
}
PARAM_LOGV("proc cmdline %s matched.", fullName);
ret = cmdLines[i].processor(fullName, nv->value);
if ((ret == 0) && (SnDealFun == cmdLines[i].processor)) {
......@@ -247,8 +252,13 @@ static int LoadDefaultParam_(const char *fileName, uint32_t mode,
const char *exclude[], uint32_t count, int (*loadOneParam)(const uint32_t *, const char *, const char *))
{
uint32_t paramNum = 0;
FILE *fp = fopen(fileName, "r");
PARAM_CHECK(fp != NULL, return -1, "Failed to open file '%s' error:%d ", fileName, errno);
char realPath[PATH_MAX] = "";
realpath(fileName, realPath);
FILE *fp = fopen(realPath, "r");
if (fp == NULL) {
PARAM_LOGE("Failed to open file '%s' error:%d ", fileName, errno);
return -1;
}
const int buffSize = PARAM_NAME_LEN_MAX + PARAM_CONST_VALUE_LEN_MAX + 10; // 10 max len
char *buffer = malloc(buffSize);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册