代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dim 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 363b0761d007fa20e165f385a085a2fcf6fc11a0 Mon Sep 17 00:00:00 2001
From: jinlun <jinlun@huawei.com>
Date: Tue, 18 Jun 2024 09:45:47 +0800
Subject: [PATCH 13/14] add parameter check
---
src/common/dim_measure_log.c | 3 +++
src/core/tasks/dim_core_measure_kernel.c | 6 +++---
src/core/tasks/dim_core_measure_module.c | 6 ++++--
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/common/dim_measure_log.c b/src/common/dim_measure_log.c
index 4b3bd34..59654a5 100644
--- a/src/common/dim_measure_log.c
+++ b/src/common/dim_measure_log.c
@@ -33,6 +33,9 @@ static int cal_measure_log_digest(const char *name,
int digest_size = dim_digest_size(info->digest.algo);
SHASH_DESC_ON_STACK(shash, hash->tfm);
+ if (algo_name == NULL)
+ return -EINVAL;
+
shash->tfm = hash->tfm;
ret = crypto_shash_init(shash);
if (ret < 0)
diff --git a/src/core/tasks/dim_core_measure_kernel.c b/src/core/tasks/dim_core_measure_kernel.c
index fa04ae4..bb7fd74 100644
--- a/src/core/tasks/dim_core_measure_kernel.c
+++ b/src/core/tasks/dim_core_measure_kernel.c
@@ -139,13 +139,13 @@ static int kernel_text_measure(int mode, struct dim_measure *m)
{
int ret = 0;
const char *kr = init_uts_ns.name.release;
- struct dim_digest digest = {
- .algo = m->hash.algo,
- };
+ struct dim_digest digest = {0};
if (m == NULL)
return -EINVAL;
+ digest.algo = m->hash.algo;
+
if (!dim_core_policy_match(DIM_POLICY_OBJ_KERNEL_TEXT,
DIM_POLICY_KEY_NAME, kr))
return 0;
diff --git a/src/core/tasks/dim_core_measure_module.c b/src/core/tasks/dim_core_measure_module.c
index feb6624..613e0e5 100644
--- a/src/core/tasks/dim_core_measure_module.c
+++ b/src/core/tasks/dim_core_measure_module.c
@@ -64,13 +64,15 @@ static int measure_module(struct dim_policy *policy, void *data)
{
int ret = 0;
struct module_text_measure_ctx *ctx = data;
- const char *mod_name = policy->name;
+ const char *mod_name = NULL;
struct dim_digest digest = { 0 };
if (policy == NULL || policy->obj != DIM_POLICY_OBJ_MODULE_TEXT ||
- mod_name == NULL)
+ policy->name == NULL)
return 0;
+ mod_name = policy->name;
+
/* if module is not inserted in baseline_init stage, ignore it */
if (ctx->mode == DIM_MEASURE &&
dim_measure_dynamic_baseline_search(ctx->m, mod_name,
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。