From 2219b337d4f4afe2ae7ad66e5d8d7c37a4b96b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Burdukiewicz?= Date: Wed, 6 Mar 2024 17:54:56 +0100 Subject: [PATCH] fdt: allow to parse dtb files that are appened with external data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bartłomiej Burdukiewicz --- src/fdt/fdt-parser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fdt/fdt-parser.cpp b/src/fdt/fdt-parser.cpp index f455165..1dcaf10 100644 --- a/src/fdt/fdt-parser.cpp +++ b/src/fdt/fdt-parser.cpp @@ -10,7 +10,10 @@ fdt_parser::fdt_parser(const char *data, u64 size, iface_fdt_generator &generato , m_handle_special_properties(handle_special_properties) { if (size >= sizeof(fdt::header)) { auto header = read_data_32be(data); - if (FDT_MAGIC_VALUE != header.magic || size != header.totalsize) + if (FDT_MAGIC_VALUE != header.magic) + return; + + if (size < header.totalsize) return; if (FDT_SUPPORT_ABOVE > header.version)