From 511d1d6b19ab88a56c6988740f83cbad45f6bc28 Mon Sep 17 00:00:00 2001 From: vasiljevic Date: Thu, 12 Jan 2006 18:35:25 +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/tclPathObj.c | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac160d6..9a76775 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-01-12 Zoran Vasiljevic + + * generic/tclPathObj.c (Tcl_FSGetInternalRep): backported + patch from core-8-4-branch. A freed pointer has been + overwritten causing all sorts of coredumps. + 2006-01-12 Vince Darley * win/tclWinFile.c: fix to sharing violation [Bug 1366227] diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index dd354c7..9ed241a 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPathObj.c,v 1.48 2005/11/27 02:33:49 das Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.49 2006/01/12 18:35:28 vasiljevic Exp $ */ #include "tclInt.h" @@ -2015,12 +2015,16 @@ Tcl_FSGetInternalRep( 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)(pathPtr); + + nativePathPtr = (*proc)(pathPtr); + srcFsPathPtr = (FsPath*) PATHOBJ(pathPtr); + srcFsPathPtr->nativePathPtr = nativePathPtr; } return srcFsPathPtr->nativePathPtr; -- cgit v0.12