diff options
author | Alan Modra <amodra@gmail.com> | 2020-04-17 08:29:15 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-04-17 10:56:01 +0930 |
commit | 8d55d10ac0d112c586eaceb92e75bd9b80aadcc4 (patch) | |
tree | 74c0545882d7abc3d8c55495c738926738fac3d2 /bfd/elf.c | |
parent | ca3f923f82a079dcf441419f4a50a50f8b4b33c2 (diff) | |
download | gdb-8d55d10ac0d112c586eaceb92e75bd9b80aadcc4.zip gdb-8d55d10ac0d112c586eaceb92e75bd9b80aadcc4.tar.gz gdb-8d55d10ac0d112c586eaceb92e75bd9b80aadcc4.tar.bz2 |
PR25842, Null pointer dereference in nm-new
PR 25842
* elf.c (_bfd_elf_get_symbol_version_string): Don't segfault on
NULL nodename.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1911,8 +1911,12 @@ _bfd_elf_get_symbol_version_string (bfd *abfd, asymbol *symbol, { const char *nodename = elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; - version_string = ((base_p || strcmp (symbol->name, nodename)) - ? nodename : ""); + version_string = ""; + if (base_p + || nodename == NULL + || symbol->name == NULL + || strcmp (symbol->name, nodename) != 0) + version_string = nodename; } else { |