diff options
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r-- | scripts/mod/modpost.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 0a4051fbd34e..2ef9a193fcae 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -381,6 +381,12 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
381 | sechdrs = (void *)hdr + hdr->e_shoff; | 381 | sechdrs = (void *)hdr + hdr->e_shoff; |
382 | info->sechdrs = sechdrs; | 382 | info->sechdrs = sechdrs; |
383 | 383 | ||
384 | /* Check if file offset is correct */ | ||
385 | if (hdr->e_shoff > info->size) { | ||
386 | fatal("section header offset=%u in file '%s' is bigger then filesize=%lu\n", hdr->e_shoff, filename, info->size); | ||
387 | return 0; | ||
388 | } | ||
389 | |||
384 | /* Fix endianness in section headers */ | 390 | /* Fix endianness in section headers */ |
385 | for (i = 0; i < hdr->e_shnum; i++) { | 391 | for (i = 0; i < hdr->e_shnum; i++) { |
386 | sechdrs[i].sh_type = TO_NATIVE(sechdrs[i].sh_type); | 392 | sechdrs[i].sh_type = TO_NATIVE(sechdrs[i].sh_type); |