diff options
author | 2017-10-28 09:30:27 +0000 | |
---|---|---|
committer | 2017-10-28 09:30:27 +0000 | |
commit | 3bdd127352ff197e8ef89b321d3fabbc9bff6e8e (patch) | |
tree | 8b965a93bf502a738899bdfde79856a8df2f5665 | |
parent | Correct an integer overflow check to detect invalid CTF section. (diff) | |
download | wireguard-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.c | 5 |
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]; |