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) _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"