dmidecode/dmidecode-fix-crash-with-u-option.patch
Jean Delvare 1fd9cd5e27 2 recommended fixes from upstream:
- dmidecode-fix-the-condition-error-in-ascii_filter.patch:
  dmidecode: Fix the condition error in ascii_filter.
- dmidecode-fix-crash-with-u-option.patch: dmidecode: Fix crash
  with -u option.

OBS-URL: https://build.opensuse.org/package/show/Base:System/dmidecode?expand=0&rev=60
2021-01-22 15:04:31 +00:00

31 lines
1.0 KiB
Diff

From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 19 Jan 2021 16:26:01 +0100
Subject: dmidecode: Fix crash with -u option
Git-commit: 11e134e54d15e67a64c39a623f492a28df922517
Patch-mainline: yes
A segmentation fault was reported with option -u. Turns out to be a
stupid thinko where the buffer offset was reset at the wrong loop
depth.
Reported-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Fixes: da06888d08b9 ("dmidecode: Use the print helpers in dump mode too")
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- dmidecode-3.3.orig/dmidecode.c 2021-01-22 15:51:26.330074180 +0100
+++ dmidecode-3.3/dmidecode.c 2021-01-22 15:51:29.445143171 +0100
@@ -248,9 +248,9 @@ static void dmi_dump(const struct dmi_he
{
int j, l = strlen(s) + 1;
- off = 0;
for (row = 0; row < ((l - 1) >> 4) + 1; row++)
{
+ off = 0;
for (j = 0; j < 16 && j < l - (row << 4); j++)
off += sprintf(raw_data + off,
j ? " %02X" : "%02X",