nm: Simplify naming of invalid sections, check shdr isn't NULL.

When shdr is NULL or the sh_name index is invalid, don't try to use
it.  Just call the section "[invalid section name]". Don't try to be
too smart by creating a dynamic invalid name using alloca to simplify
memory usage in this exceptional case.

Signed-off-by: Mark Wielaard <mark@klomp.org>
2 files changed