[DTrace-devel] [PATCH 14/15] Fix SEGV when dt_set_errmsg() is called outside of compilation

Kris Van Hees kris.van.hees at oracle.com
Fri May 29 10:59:48 PDT 2020


Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_error.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libdtrace/dt_error.c b/libdtrace/dt_error.c
index 43df081e..e08962f8 100644
--- a/libdtrace/dt_error.c
+++ b/libdtrace/dt_error.c
@@ -145,7 +145,8 @@ dt_set_errmsg(dtrace_hdl_t *dtp, const char *errtag, const char *region,
 	s = dtp->dt_errmsg;
 	n = sizeof (dtp->dt_errmsg);
 
-	if (errtag != NULL && (yypcb->pcb_cflags & DTRACE_C_ETAGS))
+	if (errtag != NULL && ((dtp->dt_cflags & DTRACE_C_ETAGS) ||
+			       (yypcb && yypcb->pcb_cflags & DTRACE_C_ETAGS)))
 		(void) snprintf(s, n, "[%s] ", errtag);
 	else
 		s[0] = '\0';
-- 
2.26.0




More information about the DTrace-devel mailing list