aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-kernel/ipmitool/ipmitool/0003-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch
diff options
context:
space:
mode:
authorWenlin Kang <wenlin.kang@windriver.com>2020-03-17 07:41:19 -0700
committerArmin Kuster <akuster808@gmail.com>2020-03-21 19:47:04 -0700
commit8c218ae9ace9613a2aa9d3fc700bae9020991194 (patch)
tree795802beb3510a722546da48c88130c5f3efd10b /meta-oe/recipes-kernel/ipmitool/ipmitool/0003-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch
parent22862f7bdc690268ab44548576f002cf585a6f78 (diff)
downloadmeta-openembedded-contrib-8c218ae9ace9613a2aa9d3fc700bae9020991194.tar.gz
meta-openembedded-contrib-8c218ae9ace9613a2aa9d3fc700bae9020991194.tar.bz2
meta-openembedded-contrib-8c218ae9ace9613a2aa9d3fc700bae9020991194.zip
ipmitool: fix CVE-2020-5208
Fix CVE-2020-5208 Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-oe/recipes-kernel/ipmitool/ipmitool/0003-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch')
-rw-r--r--meta-oe/recipes-kernel/ipmitool/ipmitool/0003-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0003-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0003-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch
new file mode 100644
index 0000000000..6b50225332
--- /dev/null
+++ b/meta-oe/recipes-kernel/ipmitool/ipmitool/0003-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch
@@ -0,0 +1,53 @@
+From 89621b1ce67065fb9044b73c215862fc8aef523f Mon Sep 17 00:00:00 2001
+From: Chrostoper Ertl <chertl@microsoft.com>
+Date: Thu, 28 Nov 2019 16:51:49 +0000
+Subject: [PATCH 3/6] session: Fix buffer overflow in ipmi_get_session_info
+
+Partial fix for CVE-2020-5208, see
+https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp
+
+The `ipmi_get_session_info` function does not properly check the
+response `data_len`, which is used as a copy size, allowing stack buffer
+overflow.
+
+Upstream-Status: Backport[https://github.com/ipmitool/ipmitool/commit/41d7026946fafbd4d1ec0bcaca3ea30a6e8eed22]
+CVE: CVE-2020-5208
+
+Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
+---
+ lib/ipmi_session.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/lib/ipmi_session.c b/lib/ipmi_session.c
+index 141f0f4..b9af1fd 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,8 +343,10 @@ 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.23.0
+