default_ehdr assumes the passed ehdr pointer is not NULL and can be
directly dereferenced. But getehdr can return NULL. So explicitly
check.
* libelf/elf32_updatenull.c (updatenull_wrlock): Check ehdr is
not NULL.
https://sourceware.org/bugzilla/show_bug.cgi?id=33433
Signed-off-by: Mark Wielaard <mark@klomp.org>
ehdr = __elfw2(LIBELFBITS,getehdr_wrlock) (elf);
/* Set the default values. */
- if (ELFW(default_ehdr,LIBELFBITS) (elf, ehdr, shnum, change_bop) != 0)
+ if (ehdr == NULL
+ || ELFW(default_ehdr,LIBELFBITS) (elf, ehdr, shnum, change_bop) != 0)
return -1;
/* At least the ELF header is there. */