diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-05 20:50:44 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-05 20:50:44 +0000 |
| commit | 2b532af82919b9141e7fd04becf354a0a7dfa813 (patch) | |
| tree | e187c00fd265d6ad19069123f410fe07dd454c6f /lib | |
| parent | a45fc83cc54489490d94596a2ea0671cc26047ca (diff) | |
| parent | fd3e9b38968782eb3d84d4db3242d1293a1f2054 (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) |
