1 Star 0 Fork 12

streamlet_hy/ipmitool-oe

forked from src-openEuler/ipmitool 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ipmitool-CVE-2020-5208-Fix-buffer-overflow-in-ipmi_get_session_info.patch 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
t.feng 提交于 2020-03-13 21:19 . init
From 5ab6d04b43ebdce0b7de62cae051cd554e9a52a1 Mon Sep 17 00:00:00 2001
From: fengtao40 <fengtao40@huawei.com>
Date: Tue, 11 Feb 2020 21:08:07 -0500
Subject: [PATCH] Fix buffer overflow in ipmi_get_session_info
---
lib/ipmi_session.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/ipmi_session.c b/lib/ipmi_session.c
index 141f0f4..01d3c24 100644
--- a/lib/ipmi_session.c
+++ b/lib/ipmi_session.c
@@ -309,8 +309,10 @@ ipmi_get_session_info(struct ipmi_intf * intf,
}
else
{
- memcpy(&session_info, rsp->data, rsp->data_len);
- print_session_info(&session_info, rsp->data_len);
+ memcpy(&session_info, rsp->data,
+ __min(rsp->data_len, sizeof(session_info)));
+ print_session_info(&session_info,
+ __min(rsp->data_len, sizeof(session_info)));
}
break;
@@ -341,9 +343,11 @@ ipmi_get_session_info(struct ipmi_intf * intf,
break;
}
- memcpy(&session_info, rsp->data, rsp->data_len);
- print_session_info(&session_info, rsp->data_len);
-
+ memcpy(&session_info, rsp->data,
+ __min(rsp->data_len, sizeof(session_info)));
+ print_session_info(&session_info,
+ __min(rsp->data_len, sizeof(session_info)));
+
} while (i <= session_info.session_slot_count);
break;
}
--
2.19.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/streamlet_hy/ipmitool.git
git@gitee.com:streamlet_hy/ipmitool.git
streamlet_hy
ipmitool
ipmitool-oe
master

搜索帮助