summaryrefslogtreecommitdiffstats
path: root/generic/tclTrace.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-10-17 22:24:38 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-10-17 22:24:38 (GMT)
commite37850ab1c67a3e6c3b23fddc07afeaefd699994 (patch)
tree73cc20454bd6e9474de58f51516404cd186d8940 /generic/tclTrace.c
parent0e16374028b1faf8f321a454f9a965b065bd5a1e (diff)
downloadtcl-e37850ab1c67a3e6c3b23fddc07afeaefd699994.zip
tcl-e37850ab1c67a3e6c3b23fddc07afeaefd699994.tar.gz
tcl-e37850ab1c67a3e6c3b23fddc07afeaefd699994.tar.bz2
Fix [Bug 2629338]: Stop evil unset traces from accessing freed memory.
Diffstat (limited to 'generic/tclTrace.c')
-rw-r--r--generic/tclTrace.c15
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;