create-klp-module: check symtab in main()

Make sure symtab section was found before dereferencing it.

Found by covscan, see issue #984 for full log.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2019-07-31 14:29:43 +02:00
parent bba18e3612
commit 5cd9833b0d

View File

@ -486,6 +486,9 @@ int main(int argc, char *argv[])
/* Rebuild rela sections, new klp rela sections will be rebuilt too. */
symtab = find_section_by_name(&kelf->sections, ".symtab");
if (!symtab)
ERROR("missing .symtab section");
list_for_each_entry(sec, &kelf->sections, list) {
if (!is_rela_section(sec))
continue;