elf: fix minimum file size calculation.

there is only a single file header, multiple sections.
This commit is contained in:
Gustavo Sverzut Barbieri 2011-12-19 14:34:00 -02:00 committed by Lucas De Marchi
parent ab70dce181
commit fc27344ed9
1 changed files with 1 additions and 1 deletions

View File

@ -322,7 +322,7 @@ struct kmod_elf *kmod_elf_new(const void *memory, off_t size)
elf->header.section.entry_size, shdr_size);
goto invalid;
}
min_size = hdr_size * shdr_size * elf->header.section.count;
min_size = hdr_size + shdr_size * elf->header.section.count;
if (min_size >= elf->size) {
ELFDBG(elf, "file is too short to hold sections\n");
goto invalid;