smbios: sanitize type from external type before checking have_fields_bitmap
commit57e3069641d057a9ca90bb603c86477d5b331ecd
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 5 Sep 2022 10:32:44 +0000 (5 12:32 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 18 Sep 2022 07:17:40 +0000 (18 09:17 +0200)
tree44674faa3476c474367c442ab4d6382ce170a70c
parentb00e2c68c5864b4158afc924d868f5c5611a0362
smbios: sanitize type from external type before checking have_fields_bitmap

test_bit uses header->type as an offset; if the file incorrectly specifies a
type greater than 127, smbios_entry_add will read and write garbage.

To fix this, just pass the smbios data through, assuming the user knows what
to do.  Reported by Coverity as CID 1487255.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/smbios/smbios.c