summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorBryan Cantrill <bryan@joyent.com>2015-07-06 19:51:59 +0000
committerBryan Cantrill <bryan@joyent.com>2015-07-06 19:51:59 +0000
commita834edec4adced4d5f36b3595035c02853fc4326 (patch)
tree65a927e400862a46a7135d0fea1a9740bc0f54f7 /usr
parentf11c74658e3c80dcffe8244d5ae6a22c62e8f395 (diff)
downloadillumos-joyent-a834edec4adced4d5f36b3595035c02853fc4326.tar.gz
OS-4487 elfdump can die on truncated ELF files
Diffstat (limited to 'usr')
-rw-r--r--usr/src/cmd/sgs/elfdump/common/elfdump.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.c b/usr/src/cmd/sgs/elfdump/common/elfdump.c
index b2dd0afe1d..fb4f9f6883 100644
--- a/usr/src/cmd/sgs/elfdump/common/elfdump.c
+++ b/usr/src/cmd/sgs/elfdump/common/elfdump.c
@@ -25,6 +25,10 @@
*/
/*
+ * Copyright (c) 2015, Joyent, Inc. All rights reserved.
+ */
+
+/*
* Dump an elf file.
*/
#include <stddef.h>
@@ -4747,6 +4751,7 @@ shdr_cache(const char *file, Elf *elf, Ehdr *ehdr, size_t shstrndx,
* final bytes.
*/
if ((_cache->c_shdr->sh_type == SHT_STRTAB) &&
+ (_cache->c_data != NULL) &&
(_cache->c_data->d_buf != NULL) &&
(_cache->c_data->d_size > 0)) {
const char *s = _cache->c_data->d_buf;