Check if enough bytes are available for Elf32_Ehdr, not Elf32_Shdr.
The size of Elf32_Shdr is needed later on.
Since both are 64 bytes, no functional change.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/279
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Elf32_Ehdr *hdr;
shdr_size = sizeof(Elf32_Shdr);
- if (!elf_range_valid(elf, 0, shdr_size))
+ if (!elf_range_valid(elf, 0, sizeof(*hdr)))
goto invalid;
LOAD_HEADER;
} else {
Elf64_Ehdr *hdr;
shdr_size = sizeof(Elf64_Shdr);
- if (!elf_range_valid(elf, 0, shdr_size))
+ if (!elf_range_valid(elf, 0, sizeof(*hdr)))
goto invalid;
LOAD_HEADER;
}