=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ctfdump/ctfdump.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/ctfdump/ctfdump.c 2017/10/05 02:59:39 1.9 --- src/usr.bin/ctfdump/ctfdump.c 2017/10/05 03:06:14 1.10 *************** *** 1,4 **** ! /* $OpenBSD: ctfdump.c,v 1.9 2017/10/05 02:59:39 jsg Exp $ */ /* * Copyright (c) 2016 Martin Pieuchot --- 1,4 ---- ! /* $OpenBSD: ctfdump.c,v 1.10 2017/10/05 03:06:14 jsg Exp $ */ /* * Copyright (c) 2016 Martin Pieuchot *************** *** 181,186 **** --- 181,189 ---- if (ELF_ST_TYPE(st->st_info) != type) continue; + if (st->st_name >= strtabsz) + break; + *idx = i; return strtab + st->st_name; } *************** *** 218,223 **** --- 221,229 ---- continue; if (strncmp(shstab + sh->sh_name, ELF_CTF, strlen(ELF_CTF))) + continue; + + if ((sh->sh_offset + sh->sh_size) > filesize) continue; if (!isctf(p + sh->sh_offset, sh->sh_size))