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

!348 修复 HasSystemCapability 没有判断输入参数为 null 的问题。

Merge pull request !348 from chenyude/syscap-null
......@@ -33,6 +33,11 @@ bool HasSystemCapability(const char *cap)
char paramValue[PARAM_VALUE_LEN_MAX] = { 0 };
unsigned int valueLen = PARAM_VALUE_LEN_MAX;
if (cap == NULL) {
BEGET_LOGE("cap input is null.");
return false;
}
if (strncmp(SYSCAP_PREFIX_NAME, cap, sizeof(SYSCAP_PREFIX_NAME) - 1) == 0) {
if (snprintf_s(capName, SYSCAP_MAX_SIZE, SYSCAP_MAX_SIZE - 1, "const.%s", cap) == -1) {
BEGET_LOGE("Failed snprintf_s err=%d", errno);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册