Report of the static analyzer:
DEREF_OF_NULL.RET Pointer, returned from function 'elf_getarhdr' at
readelf.c:13551, may be NULL and is dereferenced at readelf.c:13553.
* src/readelf.c (dump_archive_index): Check elf_getarhdr doesn't
return NULL.
Triggers found by static analyzer Svace.
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
as_off, fname, elf_errmsg (-1));
const Elf_Arhdr *h = elf_getarhdr (subelf);
-
- printf (_("Archive member '%s' contains:\n"), h->ar_name);
+ if (h != NULL)
+ printf (_("Archive member '%s' contains:\n"), h->ar_name);
elf_end (subelf);
}