diff options
Diffstat (limited to 'src/readelf.c')
| -rw-r--r-- | src/readelf.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/readelf.c b/src/readelf.c index ef61d4cd600fe..40bcfab11dca9 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: readelf.c,v 1.165 2019/05/07 02:27:11 christos Exp $") +FILE_RCSID("@(#)$File: readelf.c,v 1.168 2019/12/16 03:49:19 christos Exp $") #endif #ifdef BUILTIN_ELF @@ -1140,6 +1140,9 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size, */ return xnh_sizeof + offset; } + /*XXX: GCC */ + memset(&nh32, 0, sizeof(nh32)); + memset(&nh64, 0, sizeof(nh64)); memcpy(xnh_addr, &nbuf[offset], xnh_sizeof); offset += xnh_sizeof; @@ -1345,6 +1348,13 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, } name_off = xsh_offset; + if (fsize != SIZE_UNKNOWN && fsize < name_off) { + if (file_printf(ms, ", too large section header offset %td", + name_off) == -1) + return -1; + return 0; + } + for ( ; num; num--) { /* Read the name of this section. */ if ((namesize = pread(fd, name, sizeof(name) - 1, @@ -1628,7 +1638,6 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off, /* Things we can determine before we seek */ switch (xph_type) { case PT_DYNAMIC: - linking_style = "dynamically"; doread = 1; break; case PT_NOTE: @@ -1644,6 +1653,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off, } /*FALLTHROUGH*/ case PT_INTERP: + linking_style = "dynamically"; doread = 1; break; default: |
