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

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