git: b56b601c5ba6 - main - dtrace: Improve DOF string table validation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Jul 2026 13:28:29 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=b56b601c5ba603031312b9bc7ae895ecb0dcdaec
commit b56b601c5ba603031312b9bc7ae895ecb0dcdaec
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-06 13:21:24 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-06 13:21:24 +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
---
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);
}