A missing string value is indicated by a string index of 0. In this case
print 'Not Specified' like the Linux dmidecode command does.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
{
const char *str = (char *)table +
((struct smbios_header *)table)->length;
+ static const char fallback[] = "Not Specified";
+
+ if (!index)
+ return fallback;
if (!*str)
++str;
if (table->type == SMBIOS_END_OF_TABLE)
return NULL;
- str = smbios_get_string(table, 0);
+ str = smbios_get_string(table, -1);
return (struct smbios_header *)(++str);
}