summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-10-28 09:30:28 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-10-28 09:30:28 +0000
commitffa52b0ae31989121571fa3f62063f166ec01d88 (patch)
tree52c95a7ab059f2497bf2a08ac449e08e57e1e700 /usr.bin
parentda34eebfe2bc15fcb0547462c4d7c11622fb0372 (diff)
Correctly handle binaries without string table.
Found by jsg@ with afl(1).
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ctfdump/ctfdump.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ctfdump/ctfdump.c b/usr.bin/ctfdump/ctfdump.c
index 7db4bcfb416..4feb1beda45 100644
--- a/usr.bin/ctfdump/ctfdump.c
+++ b/usr.bin/ctfdump/ctfdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctfdump.c,v 1.16 2017/10/28 09:26:16 mpi Exp $ */
+/* $OpenBSD: ctfdump.c,v 1.17 2017/10/28 09:30:27 mpi Exp $ */
/*
* Copyright (c) 2016 Martin Pieuchot <mpi@openbsd.org>
@@ -175,6 +175,9 @@ elf_idx2sym(size_t *idx, uint8_t type)
const Elf_Sym *st;
size_t i;
+ if (strtab == NULL)
+ return NULL;
+
for (i = *idx + 1; i < nsymb; i++) {
st = &symtab[i];