diff options
author | Bryan Cantrill <bryan@joyent.com> | 2015-07-06 19:51:59 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2015-08-30 18:54:35 -0700 |
commit | 9bc2928da4128bbbe0feaaa43090efe2ea01abe2 (patch) | |
tree | a1592b7edc18a5ba07f32a75a9a2a08ee0a64198 /usr/src | |
parent | 1437283407f89cab03860accf49408f94559bc34 (diff) | |
download | illumos-joyent-9bc2928da4128bbbe0feaaa43090efe2ea01abe2.tar.gz |
6177 elfdump can die on truncated ELF files
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/sgs/elfdump/common/elfdump.c | 5 |
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; |