From 23386ce96e1828c6b8f4dc5eee50467d8cf286ab Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Mon, 13 Feb 2023 00:50:05 +0000 Subject: [PATCH] Fix load of null pointer Found by: 0_o I am EMPTY, mister EMPTY, ZarTek-Creole Patch by: michaelortmann Fixes: #1389 --- src/net.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/net.c b/src/net.c index 7539500fe..30e1f4cb8 100644 --- a/src/net.c +++ b/src/net.c @@ -1700,6 +1700,12 @@ char *traced_natip(ClientData cd, Tcl_Interp *irp, EGG_CONST char *name1, int r; struct in_addr ia; + /* Recover trace in case of unset. */ + if (flags & TCL_TRACE_DESTROYED) { + Tcl_TraceVar2(irp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, traced_natip, cd); + return NULL; + } + value = Tcl_GetVar2(irp, name1, name2, TCL_GLOBAL_ONLY); if (*value) { r = inet_pton(AF_INET, value, &ia);