diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2017-01-05 02:33:10 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2017-01-05 02:33:10 +0000 |
| commit | 1f7967e13ba643bd84796927647036546720de60 (patch) | |
| tree | 5a9f3ad49865b211e9f456c083f04e5260d35914 /lib | |
| parent | d01f7b29a9cf3a4f651b8d66967b447cd3856685 (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libproc/proc_sym.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libproc/proc_sym.c b/lib/libproc/proc_sym.c index fd8d3f928e4f..a3c5e554a347 100644 --- a/lib/libproc/proc_sym.c +++ b/lib/libproc/proc_sym.c @@ -143,10 +143,12 @@ load_symtab(Elf *e, struct symtab *symtab, u_long sh_type) if (scn == NULL) return (-1); - if ((symtab->data = elf_getdata(scn, NULL)) == NULL) + nsyms = shdr.sh_size / shdr.sh_entsize; + if (nsyms > (1 << 20)) return (-1); - nsyms = shdr.sh_size / shdr.sh_entsize; + if ((symtab->data = elf_getdata(scn, NULL)) == NULL) + return (-1); symtab->index = calloc(nsyms, sizeof(u_int)); if (symtab->index == NULL) |
