From a9dbbc99f79089ed02e3d5bab6cd4df3ec6be23d Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Sat, 4 Feb 2023 12:46:03 +0000 Subject: [PATCH] Use the correct range check when parsing SMBIOS The SMBIOS specification says: Maximum size of SMBIOS Structure Table, pointed to by the Structure Table Address, in bytes. The actual size is guaranteed to be less or equal to the maximum size. So, the firmware is actually allowed to return a DMI blob smaller than the specified size. Fixes https://github.com/fwupd/fwupd/issues/5486 --- libfwupdplugin/fu-smbios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfwupdplugin/fu-smbios.c b/libfwupdplugin/fu-smbios.c index 229b3c7ca..7e65a9ce3 100644 --- a/libfwupdplugin/fu-smbios.c +++ b/libfwupdplugin/fu-smbios.c @@ -325,7 +325,7 @@ fu_smbios_setup_from_path(FuSmbios *self, const gchar *path, GError **error) dmi_fn = g_build_filename(path, "DMI", NULL); if (!g_file_get_contents(dmi_fn, &dmi_raw, &sz, error)) return FALSE; - if (sz != self->structure_table_len) { + if (sz > self->structure_table_len) { g_set_error(error, FWUPD_ERROR, FWUPD_ERROR_INVALID_FILE,