From fc27344ed970ac11eb09e7f6ab0214f51ca4575b Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Mon, 19 Dec 2011 14:34:00 -0200 Subject: [PATCH] elf: fix minimum file size calculation. there is only a single file header, multiple sections. --- libkmod/libkmod-elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index e1833cf..0cb12ed 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -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;