smex: elf: find_section: check section ptr

Validate section ptr

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
This commit is contained in:
Adrian Bonislawski 2023-11-28 08:13:10 +01:00 committed by Kai Vehmanen
parent 7501b2e094
commit c0092bbf7a
1 changed files with 5 additions and 0 deletions

View File

@ -387,6 +387,11 @@ int elf_find_section(const struct elf_module *module, const char *name)
size_t count;
int ret, i;
if (module->section == NULL) {
fprintf(stderr, "error: NULL module section\n");
return -EINVAL;
}
section = &module->section[hdr->shstrndx];
/* alloc data data */