Skip to content

Commit

Permalink
libkmod: Add another section size check
Browse files Browse the repository at this point in the history
Make sure that section is actually large enough to hold a 32 bit value.

Signed-off-by: Tobias Stoeckmann <[email protected]>
  • Loading branch information
stoeckmann committed Oct 15, 2024
1 parent 1104af1 commit 896ebe8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libkmod/libkmod-elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,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",
Expand Down

0 comments on commit 896ebe8

Please sign in to comment.