From: Tobias Stoeckmann Date: Tue, 15 Oct 2024 16:19:32 +0000 (+0200) Subject: libkmod: Add another section size check X-Git-Tag: v34~221 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c40627f927c945717b35c8c79e07912b3a702a33;p=thirdparty%2Fkmod.git libkmod: Add another section size check Make sure that section is actually large enough to hold a 32 bit value. Signed-off-by: Tobias Stoeckmann Reviewed-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/181 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 3e97aaa2..d381e365 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -781,7 +781,7 @@ static uint64_t kmod_elf_resolve_crc(const struct kmod_elf *elf, uint64_t crc, return (uint64_t)-1; } - if (crc > (size - sizeof(uint32_t))) { + if (size < sizeof(uint32_t) || crc > (size - sizeof(uint32_t))) { ELFDBG(elf, "CRC offset %" PRIu64 " is too big, section %" PRIu16 " size is %" PRIu64 "\n",