git: 9ce4cdd7d2d3 - stable/15 - dtrace: Improve DOF string table validation
Mark Johnston <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src |
|---|---|
| Message-ID | <6a67ae33.37ebb.332f745e__46992.8740918235$1785179786$gmane$org@gitrepo.freebsd.org> |
The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9ce4cdd7d2d3885a73e8940a1fd3913d493695dc commit 9ce4cdd7d2d3885a73e8940a1fd3913d493695dc Author: Mark Johnston <[email protected]> AuthorDate: 2026-07-06 13:21:24 +0000 Commit: Mark Johnston <[email protected]> CommitDate: 2026-07-27 17:34:31 +0000 dtrace: Improve DOF string table validation The check for a nul terminator implicitly assumes that the section size is positive. Make the assumption explicit. Reviewed by: christos MFC after: 2 weeks Sponsored by: CHERI Research Centre Differential Revision: https://reviews.freebsd.org/D57977 (cherry picked from commit b56b601c5ba603031312b9bc7ae895ecb0dcdaec) --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index aa8716908cb1..ff31d806664b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -14288,8 +14288,9 @@ dtrace_dof_slurp(dof_hdr_t *dof, dtrace_vstate_t *vstate, cred_t *cr, return (-1); } - if (sec->dofs_type == DOF_SECT_STRTAB && *((char *)daddr + - sec->dofs_offset + sec->dofs_size - 1) != '\0') { + if (sec->dofs_type == DOF_SECT_STRTAB && (sec->dofs_size == 0 || + *((char *)daddr + sec->dofs_offset + sec->dofs_size - 1) != + '\0')) { dtrace_dof_error(dof, "non-terminating string table"); return (-1); }