diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2023-09-20 14:49:22 +0200 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2023-09-20 14:49:22 +0200 |
commit | 592011b25160ed6bc476e6855784ed2a7c8f3bc6 (patch) | |
tree | 95a4a95f94471d7da8625a61e81f7fcee4841e8a | |
parent | lib: straight return on error on log open fail (diff) | |
download | frr-592011b25160ed6bc476e6855784ed2a7c8f3bc6.tar.xz frr-592011b25160ed6bc476e6855784ed2a7c8f3bc6.zip |
lib: clippy ELF: check existence of string table
Mostly to make coverity happy, no compiler/linker should produce broken
ELF files like this (and if it does we can't process it anyway...)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r-- | lib/elf_py.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/elf_py.c b/lib/elf_py.c index 81ca668e7..643495d8c 100644 --- a/lib/elf_py.c +++ b/lib/elf_py.c @@ -1089,7 +1089,9 @@ static void elffile_add_dynreloc(struct elffile *w, Elf_Data *reldata, symidx = relw->symidx = GELF_R_SYM(rela->r_info); sym = relw->sym = gelf_getsym(symdata, symidx, &relw->_sym); if (sym) { - relw->symname = elfdata_strptr(strdata, sym->st_name); + if (strdata) + relw->symname = elfdata_strptr(strdata, + sym->st_name); relw->symvalid = GELF_ST_TYPE(sym->st_info) != STT_NOTYPE; relw->unresolved = sym->st_shndx == SHN_UNDEF; |