diff options
author | hobbs <hobbs> | 2006-08-30 17:48:48 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2006-08-30 17:48:48 (GMT) |
commit | b2c8be043f7ca078fde3ac3ba4cdd823509a9ed9 (patch) | |
tree | 14aba76b3795594b8283cd1dfab48c4a53f8048a | |
parent | f93ed27fc1b3986b2eec97639809f0381ff7f9be (diff) | |
download | tcl-b2c8be043f7ca078fde3ac3ba4cdd823509a9ed9.zip tcl-b2c8be043f7ca078fde3ac3ba4cdd823509a9ed9.tar.gz tcl-b2c8be043f7ca078fde3ac3ba4cdd823509a9ed9.tar.bz2 |
* win/tclWinFCmd.c: [Bug 1548263] Added test for NULL return
* generic/tclIOUtil.c: from Tcl_FSGetNormalizedPath which was
causing segv's
-rw-r--r-- | generic/tclIOUtil.c | 11 | ||||
-rw-r--r-- | win/tclWinFCmd.c | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index b5cf2ec..7ee2583 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.30 2006/08/21 14:56:28 dgp Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.77.2.31 2006/08/30 17:48:48 hobbs Exp $ */ #include "tclInt.h" @@ -4013,6 +4013,9 @@ NativeCreateNativeRep(pathObjPtr) /* Make sure the normalized path is set */ validPathObjPtr = Tcl_FSGetNormalizedPath(NULL, pathObjPtr); + if (validPathObjPtr == NULL) { + return NULL; + } str = Tcl_GetStringFromObj(validPathObjPtr, &len); #ifdef __WIN32__ @@ -4028,7 +4031,7 @@ NativeCreateNativeRep(pathObjPtr) #endif nativePathPtr = ckalloc((unsigned) len); memcpy((VOID*)nativePathPtr, (VOID*)Tcl_DStringValue(&ds), (size_t) len); - + Tcl_DStringFree(&ds); return (ClientData)nativePathPtr; } @@ -5436,7 +5439,9 @@ Tcl_FSGetTranslatedPath(interp, pathPtr) retObj = srcFsPathPtr->translatedPathPtr; } - Tcl_IncrRefCount(retObj); + if (retObj) { + Tcl_IncrRefCount(retObj); + } return retObj; } diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index b8d1564..a6b0dcb 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFCmd.c,v 1.35.2.4 2005/06/23 15:05:22 kennykb Exp $ + * RCS: @(#) $Id: tclWinFCmd.c,v 1.35.2.5 2006/08/30 17:48:48 hobbs Exp $ */ #include "tclWinInt.h" @@ -902,8 +902,14 @@ TclpObjCopyDirectory(srcPathPtr, destPathPtr, errorPtr) int ret; normSrcPtr = Tcl_FSGetNormalizedPath(NULL,srcPathPtr); + if (normSrcPtr == NULL) { + return TCL_ERROR; + } Tcl_WinUtfToTChar(Tcl_GetString(normSrcPtr), -1, &srcString); normDestPtr = Tcl_FSGetNormalizedPath(NULL,destPathPtr); + if (normDestPtr == NULL) { + return TCL_ERROR; + } Tcl_WinUtfToTChar(Tcl_GetString(normDestPtr), -1, &dstString); ret = TraverseWinTree(TraversalCopy, &srcString, &dstString, &ds); @@ -971,6 +977,9 @@ TclpObjRemoveDirectory(pathPtr, recursive, errorPtr) */ Tcl_DString native; normPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr); + if (normPtr == NULL) { + return TCL_ERROR; + } Tcl_WinUtfToTChar(Tcl_GetString(normPtr), -1, &native); ret = DoRemoveDirectory(&native, recursive, &ds); Tcl_DStringFree(&native); |