]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
elf: fix minimum file size calculation.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Mon, 19 Dec 2011 16:34:00 +0000 (14:34 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Mon, 19 Dec 2011 17:06:49 +0000 (15:06 -0200)
there is only a single file header, multiple sections.

libkmod/libkmod-elf.c

index e1833cf5f1dccb80a85d7ca0bfe1e187a7861012..0cb12edb77c79e8071c7f8cd6ed6ed72141d4ccf 100644 (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;