qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] hw/smbios: verify header type for file before using it
@ 2021-11-29 13:52 Daniil Tatianin
  2022-01-04  9:34 ` Igor Mammedov
  0 siblings, 1 reply; 2+ messages in thread
From: Daniil Tatianin @ 2021-11-29 13:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: ani, imammedo, yc-core, mst

Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
---
 hw/smbios/smbios.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 7397e56737..c55f77368a 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1163,6 +1163,12 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
             return;
         }
 
+        if (header->type > SMBIOS_MAX_TYPE) {
+            error_setg(errp,
+                       "invalid header type %d!", header->type);
+            return;
+        }
+
         if (test_bit(header->type, have_fields_bitmap)) {
             error_setg(errp,
                        "can't load type %d struct, fields already specified!",
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-04  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-29 13:52 [PATCH v1] hw/smbios: verify header type for file before using it Daniil Tatianin
2022-01-04  9:34 ` Igor Mammedov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).