diff --git a/kernel/module/main.c b/kernel/module/main.c index 6c3b4a846645a5..23432fabfde8ab 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;