diff options
Diffstat (limited to 'meta-oe/recipes-kernel/ipmitool/ipmitool/0005-lanp-Fix-buffer-overflows-in-get_lan_param_select.patch')
-rw-r--r-- | meta-oe/recipes-kernel/ipmitool/ipmitool/0005-lanp-Fix-buffer-overflows-in-get_lan_param_select.patch | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0005-lanp-Fix-buffer-overflows-in-get_lan_param_select.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0005-lanp-Fix-buffer-overflows-in-get_lan_param_select.patch new file mode 100644 index 000000000..1b1dec1c1 --- /dev/null +++ b/meta-oe/recipes-kernel/ipmitool/ipmitool/0005-lanp-Fix-buffer-overflows-in-get_lan_param_select.patch | |||
@@ -0,0 +1,94 @@ | |||
1 | From f45e6d84b75dcd649e18c9256c136cda354de6fd Mon Sep 17 00:00:00 2001 | ||
2 | From: Chrostoper Ertl <chertl@microsoft.com> | ||
3 | Date: Thu, 28 Nov 2019 17:06:39 +0000 | ||
4 | Subject: [PATCH 5/6] lanp: Fix buffer overflows in get_lan_param_select | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Partial fix for CVE-2020-5208, see | ||
10 | https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp | ||
11 | |||
12 | The `get_lan_param_select` function is missing a validation check on the | ||
13 | response’s `data_len`, which it then returns to caller functions, where | ||
14 | stack buffer overflow can occur. | ||
15 | |||
16 | Upstream-Status: Backport[https://github.com/ipmitool/ipmitool/commit/d45572d71e70840e0d4c50bf48218492b79c1a10] | ||
17 | CVE: CVE-2020-5208 | ||
18 | |||
19 | [Make some changes to apply it] | ||
20 | Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> | ||
21 | --- | ||
22 | lib/ipmi_lanp.c | 14 +++++++------- | ||
23 | 1 file changed, 7 insertions(+), 7 deletions(-) | ||
24 | |||
25 | diff --git a/lib/ipmi_lanp.c b/lib/ipmi_lanp.c | ||
26 | index 65d881b..022c7f1 100644 | ||
27 | --- a/lib/ipmi_lanp.c | ||
28 | +++ b/lib/ipmi_lanp.c | ||
29 | @@ -1809,7 +1809,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, | ||
30 | if (p == NULL) { | ||
31 | return (-1); | ||
32 | } | ||
33 | - memcpy(data, p->data, p->data_len); | ||
34 | + memcpy(data, p->data, __min(p->data_len, sizeof(data))); | ||
35 | /* set new ipaddr */ | ||
36 | memcpy(data+3, temp, 4); | ||
37 | printf("Setting LAN Alert %d IP Address to %d.%d.%d.%d\n", alert, | ||
38 | @@ -1824,7 +1824,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, | ||
39 | if (p == NULL) { | ||
40 | return (-1); | ||
41 | } | ||
42 | - memcpy(data, p->data, p->data_len); | ||
43 | + memcpy(data, p->data, __min(p->data_len, sizeof(data))); | ||
44 | /* set new macaddr */ | ||
45 | memcpy(data+7, temp, 6); | ||
46 | printf("Setting LAN Alert %d MAC Address to " | ||
47 | @@ -1838,7 +1838,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, | ||
48 | if (p == NULL) { | ||
49 | return (-1); | ||
50 | } | ||
51 | - memcpy(data, p->data, p->data_len); | ||
52 | + memcpy(data, p->data, __min(p->data_len, sizeof(data))); | ||
53 | |||
54 | if (strncasecmp(argv[1], "def", 3) == 0 || | ||
55 | strncasecmp(argv[1], "default", 7) == 0) { | ||
56 | @@ -1864,7 +1864,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, | ||
57 | if (p == NULL) { | ||
58 | return (-1); | ||
59 | } | ||
60 | - memcpy(data, p->data, p->data_len); | ||
61 | + memcpy(data, p->data, __min(p->data_len, sizeof(data))); | ||
62 | |||
63 | if (strncasecmp(argv[1], "on", 2) == 0 || | ||
64 | strncasecmp(argv[1], "yes", 3) == 0) { | ||
65 | @@ -1889,7 +1889,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, | ||
66 | if (p == NULL) { | ||
67 | return (-1); | ||
68 | } | ||
69 | - memcpy(data, p->data, p->data_len); | ||
70 | + memcpy(data, p->data, __min(p->data_len, sizeof(data))); | ||
71 | |||
72 | if (strncasecmp(argv[1], "pet", 3) == 0) { | ||
73 | printf("Setting LAN Alert %d destination to PET Trap\n", alert); | ||
74 | @@ -1917,7 +1917,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, | ||
75 | if (p == NULL) { | ||
76 | return (-1); | ||
77 | } | ||
78 | - memcpy(data, p->data, p->data_len); | ||
79 | + memcpy(data, p->data, __min(p->data_len, sizeof(data))); | ||
80 | |||
81 | if (str2uchar(argv[1], &data[2]) != 0) { | ||
82 | lprintf(LOG_ERR, "Invalid time: %s", argv[1]); | ||
83 | @@ -1933,7 +1933,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, | ||
84 | if (p == NULL) { | ||
85 | return (-1); | ||
86 | } | ||
87 | - memcpy(data, p->data, p->data_len); | ||
88 | + memcpy(data, p->data, __min(p->data_len, sizeof(data))); | ||
89 | |||
90 | if (str2uchar(argv[1], &data[3]) != 0) { | ||
91 | lprintf(LOG_ERR, "Invalid retry: %s", argv[1]); | ||
92 | -- | ||
93 | 2.23.0 | ||
94 | |||