diff options
| author | Dillon Amburgey <dillona@dillona.com> | 2016-06-12 18:52:55 -0400 |
|---|---|---|
| committer | Robert Mustacchi <rm@joyent.com> | 2016-06-22 07:48:46 -0700 |
| commit | 5093b3b62da799ea81b3a0f84f606266d06ce94e (patch) | |
| tree | 17942b6fc6c4b6f3b89caebd9ceaf512f8f675d0 | |
| parent | 6aa98485cdc6dd2ec24cfbcf0ccefb5ef7796564 (diff) | |
| download | illumos-joyent-5093b3b62da799ea81b3a0f84f606266d06ce94e.tar.gz | |
7106 elfdump crashes with invalid ELF
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Robert Mustacchi <rm@joyent.com>
| -rw-r--r-- | usr/src/cmd/sgs/elfdump/common/elfdump.c | 8 |
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), |
