summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2016-06-23 11:50:36 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2016-06-23 11:50:36 +0000
commitb80fef9b7b08782fc25bfb939f3f3b42ad6169a4 (patch)
tree042ea98a7036e2b9fac7b02d6a7a8a95e2b80d42
parent8bae72dc3f645da905eab5fe960867037f57bae0 (diff)
parent5093b3b62da799ea81b3a0f84f606266d06ce94e (diff)
downloadillumos-joyent-b80fef9b7b08782fc25bfb939f3f3b42ad6169a4.tar.gz
[illumos-gate merge]
commit 5093b3b62da799ea81b3a0f84f606266d06ce94e 7106 elfdump crashes with invalid ELF commit 6aa98485cdc6dd2ec24cfbcf0ccefb5ef7796564 7124 6602 introduced unused options b and R for lofiadm command Conflicts: usr/src/cmd/lofiadm/main.c
-rw-r--r--usr/src/cmd/sgs/elfdump/common/elfdump.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.c b/usr/src/cmd/sgs/elfdump/common/elfdump.c
index fb4f9f6883..1af86ad0d2 100644
--- a/usr/src/cmd/sgs/elfdump/common/elfdump.c
+++ b/usr/src/cmd/sgs/elfdump/common/elfdump.c
@@ -1775,7 +1775,7 @@ interp(const char *file, Cache *cache, Word shnum, Word phnum, Elf *elf)
Word cnt;
Shdr *ishdr = NULL;
- Cache *icache;
+ Cache *icache = NULL;
Off iphdr_off = 0;
Xword iphdr_fsz;
@@ -1821,7 +1821,11 @@ interp(const char *file, Cache *cache, Word shnum, Word phnum, Elf *elf)
* Print the interpreter string based on the offset defined in the
* program header, as this is the offset used by the kernel.
*/
- if (ishdr && icache->c_data) {
+ if ((ishdr != NULL) &&
+ (icache != NULL) &&
+ (icache->c_data != NULL) &&
+ (icache->c_data->d_buf != NULL) &&
+ (icache->c_data->d_size > 0)) {
dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
dbg_print(0, MSG_INTL(MSG_ELF_SCN_INTERP), icache->c_name);
dbg_print(0, MSG_ORIG(MSG_FMT_INDENT),