diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2009-10-17 22:24:38 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2009-10-17 22:24:38 (GMT) |
| commit | 9a3f76b7de477c69f4d52cccb7a58ea1bb1aa579 (patch) | |
| tree | 73cc20454bd6e9474de58f51516404cd186d8940 /generic/tclTrace.c | |
| parent | 97b13a5f89a7acca656396bbf82986d84a18c389 (diff) | |
| download | tcl-9a3f76b7de477c69f4d52cccb7a58ea1bb1aa579.zip tcl-9a3f76b7de477c69f4d52cccb7a58ea1bb1aa579.tar.gz tcl-9a3f76b7de477c69f4d52cccb7a58ea1bb1aa579.tar.bz2 | |
Fix [Bug 2629338]: Stop evil unset traces from accessing freed memory.
Diffstat (limited to 'generic/tclTrace.c')
| -rw-r--r-- | generic/tclTrace.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/generic/tclTrace.c b/generic/tclTrace.c index cb40fd7..e35b7a3 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTrace.c,v 1.55 2009/02/10 23:09:05 nijtmans Exp $ + * RCS: @(#) $Id: tclTrace.c,v 1.56 2009/10/17 22:24:38 dkf Exp $ */ #include "tclInt.h" @@ -2258,7 +2258,7 @@ StringTraceProc( data->proc(data->clientData, interp, level, (char *) command, cmdPtr->proc, cmdPtr->clientData, objc, argv); - TclStackFree(interp, (void *) argv); + TclStackFree(interp, argv); return TCL_OK; } @@ -2283,7 +2283,7 @@ static void StringTraceDeleteProc( ClientData clientData) { - ckfree((char *) clientData); + ckfree(clientData); } /* @@ -2311,7 +2311,7 @@ Tcl_DeleteTrace( { Interp *iPtr = (Interp *) interp; Trace *prevPtr, *tracePtr = (Trace *) trace; - register Trace **tracePtr2 = &(iPtr->tracePtr); + register Trace **tracePtr2 = &iPtr->tracePtr; ActiveInterpTrace *activePtr; /* @@ -2320,14 +2320,14 @@ Tcl_DeleteTrace( */ prevPtr = NULL; - while ((*tracePtr2) != NULL && (*tracePtr2) != tracePtr) { + while (*tracePtr2 != NULL && *tracePtr2 != tracePtr) { prevPtr = *tracePtr2; - tracePtr2 = &((*tracePtr2)->nextPtr); + tracePtr2 = &prevPtr->nextPtr; } if (*tracePtr2 == NULL) { return; } - (*tracePtr2) = (*tracePtr2)->nextPtr; + *tracePtr2 = (*tracePtr2)->nextPtr; /* * The code below makes it possible to delete traces while traces are @@ -2899,6 +2899,7 @@ Tcl_UntraceVar2( } else { prevPtr->nextPtr = nextPtr; } + tracePtr->nextPtr = NULL; Tcl_EventuallyFree(tracePtr, TCL_DYNAMIC); for (tracePtr = nextPtr; tracePtr != NULL; |
