From 163fd9f0872f95366cfe34eb11568934c2d2fe29 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Fri, 23 Feb 2024 16:05:22 +0100 Subject: fix smbios blob length overflow When tables are more than 64K, size of copied tables will be truncated due to cast from u32 to u16, and as result only a small portion of the tables will be copied in the end. That leads to corrupted tables (a part from QEMU and remainder is whatever was in memory block allocated for the tables). Fix it by making qtables_len 32bit int. Signed-off-by: Igor Mammedov --- src/fw/biostables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 1c09a78..90712d4 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -499,7 +499,7 @@ smbios_build_tables(struct romfile_s *f_tables, u16 *number_of_structures) { struct smbios_type_0 *t0; - u16 qtables_len, need_t0 = 1; + u32 qtables_len, need_t0 = 1; u8 *qtables, *tables; if (f_tables->size != *length) -- cgit v1.1