]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/dmidecode/dmidecode-3.3-fix_crash_with_u_option.patch
dmidecode: update to 3.3
[people/pmueller/ipfire-2.x.git] / src / patches / dmidecode / dmidecode-3.3-fix_crash_with_u_option.patch
CommitLineData
740549d8
PM
1From 11e134e54d15e67a64c39a623f492a28df922517 Mon Sep 17 00:00:00 2001
2From: Jean Delvare <jdelvare@suse.de>
3Date: Tue, 19 Jan 2021 16:26:01 +0100
4Subject: dmidecode: Fix crash with -u option
5
6A segmentation fault was reported with option -u. Turns out to be a
7stupid thinko where the buffer offset was reset at the wrong loop
8depth.
9
10Reported-by: Jerry Hoemann <jerry.hoemann@hpe.com>
11Fixes: da06888d08b9 ("dmidecode: Use the print helpers in dump mode too")
12Signed-off-by: Jean Delvare <jdelvare@suse.de>
13---
14 dmidecode.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/dmidecode.c b/dmidecode.c
18index 572cb1a..69ea0e8 100644
19--- a/dmidecode.c
20+++ b/dmidecode.c
21@@ -248,9 +248,9 @@ static void dmi_dump(const struct dmi_header *h)
22 {
23 int j, l = strlen(s) + 1;
24
25- off = 0;
26 for (row = 0; row < ((l - 1) >> 4) + 1; row++)
27 {
28+ off = 0;
29 for (j = 0; j < 16 && j < l - (row << 4); j++)
30 off += sprintf(raw_data + off,
31 j ? " %02X" : "%02X",
32--
33cgit v1.2.1
34