summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2017-10-28 09:30:27 +0000
committermpi <mpi@openbsd.org>2017-10-28 09:30:27 +0000
commit3bdd127352ff197e8ef89b321d3fabbc9bff6e8e (patch)
tree8b965a93bf502a738899bdfde79856a8df2f5665
parentCorrect an integer overflow check to detect invalid CTF section. (diff)
downloadwireguard-openbsd-3bdd127352ff197e8ef89b321d3fabbc9bff6e8e.tar.xz
wireguard-openbsd-3bdd127352ff197e8ef89b321d3fabbc9bff6e8e.zip
Correctly handle binaries without string table.
Found by jsg@ with afl(1).
-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];