It turns out that variables "offset" and "key" have the same value for these lines of code, so there is no actual bug, nevertheless using the right variable makes the code more obviously correct, and less prone to introduce a bug later when adding support for new strings.
Signed-off-by: Jean Delvare <jdelv...@suse.de> --- dmidecode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- dmidecode.orig/dmidecode.c +++ dmidecode/dmidecode.c @@ -5386,12 +5386,12 @@ static void dmi_table_string(const struc switch (key) { case 0x015: /* -s bios-revision */ - if (data[key - 1] != 0xFF && data[key] != 0xFF) - printf("%u.%u\n", data[key - 1], data[key]); + if (data[offset - 1] != 0xFF && data[offset] != 0xFF) + printf("%u.%u\n", data[offset - 1], data[offset]); break; case 0x017: /* -s firmware-revision */ - if (data[key - 1] != 0xFF && data[key] != 0xFF) - printf("%u.%u\n", data[key - 1], data[key]); + if (data[offset - 1] != 0xFF && data[offset] != 0xFF) + printf("%u.%u\n", data[offset - 1], data[offset]); break; case 0x108: dmi_system_uuid(NULL, NULL, data + offset, ver); -- Jean Delvare SUSE L3 Support