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

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