git: 4d30095e2849 - stable/14 - dtrace: Improve DOF string table validation

Mark Johnston <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a67dc87.26655.aed2cee__23667.8930510365$1785191594$gmane$org@gitrepo.freebsd.org>
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=4d30095e28496445761dd65e0b7c37731a61ce25

commit 4d30095e28496445761dd65e0b7c37731a61ce25
Author:     Mark Johnston <[email protected]>
AuthorDate: 2026-07-06 13:21:24 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-07-27 14:05:07 +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);
 		}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.