summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/module/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/module/main.c b/kernel/module/main.c
index 6c3b4a846645..23432fabfde8 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -1726,6 +1726,10 @@ static int elf_validity_check(struct load_info *info)
* strings in the section safe.
*/
info->secstrings = (void *)info->hdr + strhdr->sh_offset;
+ if (strhdr->sh_size == 0) {
+ pr_err("empty section name table\n");
+ goto no_exec;
+ }
if (info->secstrings[strhdr->sh_size - 1] != '\0') {
pr_err("ELF Spec violation: section name table isn't null terminated\n");
goto no_exec;