Blame SOURCES/0024-dmidecode-Fix-crash-with-u-option.patch

aeb9bc
From 11e134e54d15e67a64c39a623f492a28df922517 Mon Sep 17 00:00:00 2001
aeb9bc
From: Jean Delvare <jdelvare@suse.de>
aeb9bc
Date: Tue, 19 Jan 2021 16:26:01 +0100
aeb9bc
Subject: [PATCH] dmidecode: Fix crash with -u option
aeb9bc
aeb9bc
A segmentation fault was reported with option -u. Turns out to be a
aeb9bc
stupid thinko where the buffer offset was reset at the wrong loop
aeb9bc
depth.
aeb9bc
aeb9bc
Reported-by: Jerry Hoemann <jerry.hoemann@hpe.com>
aeb9bc
Fixes: da06888d08b9 ("dmidecode: Use the print helpers in dump mode too")
aeb9bc
Signed-off-by: Jean Delvare <jdelvare@suse.de>
aeb9bc
---
aeb9bc
 dmidecode.c | 2 +-
aeb9bc
 1 file changed, 1 insertion(+), 1 deletion(-)
aeb9bc
aeb9bc
diff --git a/dmidecode.c b/dmidecode.c
aeb9bc
index 572cb1a..69ea0e8 100644
aeb9bc
--- a/dmidecode.c
aeb9bc
+++ b/dmidecode.c
aeb9bc
@@ -248,9 +248,9 @@ static void dmi_dump(const struct dmi_header *h)
aeb9bc
 			{
aeb9bc
 				int j, l = strlen(s) + 1;
aeb9bc
 
aeb9bc
-				off = 0;
aeb9bc
 				for (row = 0; row < ((l - 1) >> 4) + 1; row++)
aeb9bc
 				{
aeb9bc
+					off = 0;
aeb9bc
 					for (j = 0; j < 16 && j < l - (row << 4); j++)
aeb9bc
 						off += sprintf(raw_data + off,
aeb9bc
 						       j ? " %02X" : "%02X",
aeb9bc
-- 
aeb9bc
2.31.0
aeb9bc