9 Star 0 Fork 5

src-openEuler/secDetector

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Backport-fix-invalid-TUF-8-data-in-memory-corruption-module.patch 3.08 KB
一键复制 编辑 原始数据 按行查看 历史
吃牛的蛙 提交于 2023-12-14 21:54 . backport some bugfix patches
From b1a7122cfd360a9a3012555bc7e5821e1fbe7a34 Mon Sep 17 00:00:00 2001
From: yieux <yangxy79315@sina.com>
Date: Thu, 14 Dec 2023 17:02:34 +0800
Subject: [PATCH 4/4] fix invalid TUF-8 data in memory corruption module
---
.../analyze_unit/secDetector_save_check.c | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/kerneldriver/core/analyze_unit/secDetector_save_check.c b/kerneldriver/core/analyze_unit/secDetector_save_check.c
index 72c4948..0ab40ce 100644
--- a/kerneldriver/core/analyze_unit/secDetector_save_check.c
+++ b/kerneldriver/core/analyze_unit/secDetector_save_check.c
@@ -124,25 +124,25 @@ static int analyze_save_check_normal(struct list_head *collect_data_list, analyz
break;
}
if (measure_value != analyze_status_data->sc_data.data[data_index]) {
- pr_debug("[save_check]%s: original: %llx; now: %llx.!\n",
+ pr_debug("[save_check]%s: original: %lld; now: %lld.!\n",
cd->name, analyze_status_data->sc_data.data[data_index], measure_value);
- response_arrays[response_array_index] = kmalloc(strlen(cd->name) + REPORT_MORE_CHAR_LEN, GFP_KERNEL);
+ response_arrays[response_array_index] = kzalloc(strlen(cd->name) + REPORT_MORE_CHAR_LEN, GFP_KERNEL);
if (response_arrays[response_array_index] == NULL) {
- pr_err("kmalloc failed");
+ pr_err("kzalloc failed");
ret = -ENOMEM;
goto end;
}
- strcpy(response_arrays[response_array_index], "[save_check]");
+ strcpy(response_arrays[response_array_index], " secswitch_name=");
//应该有 workflow的名字
strncat(response_arrays[response_array_index], cd->name, strlen(cd->name));
- strcat(response_arrays[response_array_index],": original: ");
- sprintf(int_str, "%llx", analyze_status_data->sc_data.data[data_index]);
+ strcat(response_arrays[response_array_index]," old_value=");
+ sprintf(int_str, "%lld", analyze_status_data->sc_data.data[data_index]);
strncat(response_arrays[response_array_index], int_str, strlen(int_str));
- strcat(response_arrays[response_array_index],"; now: ");
- sprintf(int_str, "%llx", measure_value);
+ strcat(response_arrays[response_array_index]," new_value=");
+ sprintf(int_str, "%lld", measure_value);
strncat(response_arrays[response_array_index], int_str, strlen(int_str));
- strcat(response_arrays[response_array_index],".!\n");
+ strcat(response_arrays[response_array_index],".\n");
response_data_char_len += strlen(response_arrays[response_array_index]);
ret = RESPONSE_REPORT;
@@ -156,9 +156,9 @@ static int analyze_save_check_normal(struct list_head *collect_data_list, analyz
timestamp_len = get_timestamp_str(&timestamp);
response_data->report_data.type = event_type;
response_data->report_data.len = response_data_char_len + timestamp_len;
- response_data->report_data.text = kmalloc(response_data->report_data.len + 1, GFP_KERNEL);
+ response_data->report_data.text = kzalloc(response_data->report_data.len + 1, GFP_KERNEL);
if (response_data->report_data.text == NULL) {
- pr_err("kmalloc failed");
+ pr_err("kzalloc failed");
ret = -ENOMEM;
goto end;
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/secDetector.git
git@gitee.com:src-openeuler/secDetector.git
src-openeuler
secDetector
secDetector
master

搜索帮助