summaryrefslogtreecommitdiff
path: root/dmidecode.c
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2021-01-19 16:26:01 +0100
committerJean Delvare <jdelvare@suse.de>2021-01-19 16:26:01 +0100
commit11e134e54d15e67a64c39a623f492a28df922517 (patch)
treee93f12a63524c810eea8b1532886d1a59043d16c /dmidecode.c
parentbd8636e4b5e2fe95373b3ade1cdc5ec2d6578ca4 (diff)
downloaddmidecode-git-11e134e54d15e67a64c39a623f492a28df922517.tar.gz
dmidecode: Fix crash with -u option
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>
Diffstat (limited to 'dmidecode.c')
-rw-r--r--dmidecode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dmidecode.c b/dmidecode.c
index 572cb1a..69ea0e8 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -248,9 +248,9 @@ static void dmi_dump(const struct dmi_header *h)
{
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",