未验证 提交 dcc408bf 编写于 作者: 熊磊 提交者: Gitee

update services/init/init_service_manager.c.

Signed-off-by: Nxionglei <xionglei6@huawei.com>
上级 33267194
......@@ -232,7 +232,7 @@ void ReleaseService(Service *service)
static char *GetStringValue(const cJSON *json, const char *name, size_t *strLen)
{
char *fieldStr = cJSON_GetStringValue(cJSON_GetObjectItem(json, name));
INIT_ERROR_CHECK(fieldStr != NULL, return NULL, "Failed to get string for %s", name);
INIT_CHECK(fieldStr != NULL, return NULL);
*strLen = strlen(fieldStr);
return fieldStr;
}
......@@ -242,8 +242,8 @@ static int GetStringItem(const cJSON *json, const char *name, char *buffer, int
INIT_ERROR_CHECK(json != NULL, return SERVICE_FAILURE, "Invalid json for %s", name);
size_t strLen = 0;
char *fieldStr = GetStringValue(json, name, &strLen);
INIT_ERROR_CHECK((fieldStr != NULL) && (strLen != 0) && (strLen <= (size_t)buffLen),
return SERVICE_FAILURE, "Invalid str filed %s for %s", fieldStr, name);
INIT_CHECK((fieldStr != NULL) && (strLen != 0) && (strLen <= (size_t)buffLen),
return SERVICE_FAILURE);
return strcpy_s(buffer, buffLen, fieldStr);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册