Date: Thu, 5 Jan 2017 02:33:10 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311348 - head/lib/libproc Message-ID: <201701050233.v052XAi7028759@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Thu Jan 5 02:33:10 2017 New Revision: 311348 URL: https://svnweb.freebsd.org/changeset/base/311348 Log: Add a reasonable bound on the symbol table index size. Modified: head/lib/libproc/proc_sym.c Modified: head/lib/libproc/proc_sym.c ============================================================================== --- head/lib/libproc/proc_sym.c Thu Jan 5 02:04:53 2017 (r311347) +++ head/lib/libproc/proc_sym.c Thu Jan 5 02:33:10 2017 (r311348) @@ -143,10 +143,12 @@ load_symtab(Elf *e, struct symtab *symta 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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701050233.v052XAi7028759>