From 8fdd6a29a9c9eb192eadf1c481e74db3162cc3d3 Mon Sep 17 00:00:00 2001 From: vasiljevic Date: Thu, 12 Jan 2006 18:03:46 +0000 Subject: Fixed potential overwriting of already freed memory which caused all kinds of (rare but reproducible) coredumps all over the place. --- ChangeLog | 6 ++++++ generic/tclIOUtil.c | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c030b8..0aeb4cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-01-12 Zoran Vasiljevic + + * generic/tclIOUtil.c (Tcl_FSGetInternalRep): fixed potential + overwriting of already freed memory which caused all kinds of + (rare but reproducible) coredumps all over the place. + 2006-01-11 Don Porter * tests/error.test (error-7.0): Test the timing of write traces diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 638355c..5e0acbb 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.77.2.24 2005/12/15 04:08:26 das Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.77.2.25 2006/01/12 18:03:48 vasiljevic Exp $ */ #include "tclInt.h" @@ -5863,12 +5863,16 @@ Tcl_FSGetInternalRep(pathObjPtr, fsPtr) if (srcFsPathPtr->nativePathPtr == NULL) { Tcl_FSCreateInternalRepProc *proc; - proc = srcFsPathPtr->fsRecPtr->fsPtr->createInternalRepProc; + char *nativePathPtr; + proc = srcFsPathPtr->fsRecPtr->fsPtr->createInternalRepProc; if (proc == NULL) { return NULL; } - srcFsPathPtr->nativePathPtr = (*proc)(pathObjPtr); + + nativePathPtr = (*proc)(pathObjPtr); + srcFsPathPtr = (FsPath*) PATHOBJ(pathObjPtr); + srcFsPathPtr->nativePathPtr = nativePathPtr; } return srcFsPathPtr->nativePathPtr; -- cgit v0.12