summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--generic/tclIOUtil.c24
-rw-r--r--generic/tclPathObj.c6
-rw-r--r--unix/tclUnixFile.c5
-rw-r--r--win/tclWinFCmd.c11
-rw-r--r--win/tclWinFile.c16
6 files changed, 48 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 6044326..05b1b5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-08-29 Colin McCormack <coldstore@users.sourceforge.net>
+
+ * generic/tclIOUtil.c: Added test for NULL return
+ * generic/tclPathObj.c: from Tcl_FSGetNormalizedPath
+ * unix/tclUnixFile.c: which was causing segv's per
+ * win/tclWinFCmd.c: Bug 1548263
+ * /win/tclWinFile.c:
+
2006-08-28 Kevin Kenny <kennykb@acm.org>
* library/tzdata/America/Havana: Regenerated from Olson's
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index ccd1e12..68cac51 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.133 2006/08/21 14:56:48 dgp Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.134 2006/08/29 00:36:57 coldstore Exp $
*/
#include "tclInt.h"
@@ -1234,6 +1234,7 @@ FsAddMountsToGlobResult(
int len, mlen;
CONST char *path;
CONST char *mount;
+ Tcl_Obj *norm;
/*
* We know mElt is absolute normalized and lies inside pathPtr, so
@@ -1242,18 +1243,19 @@ FsAddMountsToGlobResult(
*/
mount = Tcl_GetStringFromObj(mElt, &mlen);
- path = Tcl_GetStringFromObj(Tcl_FSGetNormalizedPath(NULL, pathPtr),
- &len);
- if (path[len-1] == '/') {
- /*
- * Deal with the root of the volume.
- */
+ norm = Tcl_FSGetNormalizedPath(NULL, pathPtr);
+ if (norm != NULL) {
+ path = Tcl_GetStringFromObj(norm, &len);
+ if (path[len-1] == '/') {
+ /*
+ * Deal with the root of the volume.
+ */
- len--;
+ len--;
+ }
+ mElt = TclNewFSPathObj(pathPtr, mount + len + 1, mlen - len);
+ Tcl_ListObjAppendElement(NULL, resultPtr, mElt);
}
- mElt = TclNewFSPathObj(pathPtr, mount + len + 1, mlen - len);
- Tcl_ListObjAppendElement(NULL, resultPtr, mElt);
-
/*
* No need to increment gLength, since we don't want to compare
* mounts against mounts.
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index ba8d155..c73eee8 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.55 2006/04/07 14:05:29 dgp Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.56 2006/08/29 00:36:57 coldstore Exp $
*/
#include "tclInt.h"
@@ -1599,7 +1599,9 @@ Tcl_FSGetTranslatedPath(
retObj = srcFsPathPtr->translatedPathPtr;
}
- Tcl_IncrRefCount(retObj);
+ if (retObj != NULL) {
+ Tcl_IncrRefCount(retObj);
+ }
return retObj;
}
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 2f2ebc4..e278eae 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.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: tclUnixFile.c,v 1.49 2006/03/25 01:47:56 das Exp $
+ * RCS: @(#) $Id: tclUnixFile.c,v 1.50 2006/08/29 00:36:57 coldstore Exp $
*/
#include "tclInt.h"
@@ -1089,6 +1089,9 @@ TclNativeCreateNativeRep(
*/
validPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
+ if (validPathPtr == NULL) {
+ return NULL;
+ }
Tcl_IncrRefCount(validPathPtr);
}
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index 3d95de9..c940620 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.51 2005/12/13 22:43:18 kennykb Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.52 2006/08/29 00:36:57 coldstore Exp $
*/
#include "tclWinInt.h"
@@ -925,8 +925,12 @@ TclpObjCopyDirectory(
int ret;
normSrcPtr = Tcl_FSGetNormalizedPath(NULL,srcPathPtr);
- Tcl_WinUtfToTChar(Tcl_GetString(normSrcPtr), -1, &srcString);
normDestPtr = Tcl_FSGetNormalizedPath(NULL,destPathPtr);
+ if ((normSrcPtr == NULL) || (normDestPtr == NULL)) {
+ return TCL_ERROR;
+ }
+
+ Tcl_WinUtfToTChar(Tcl_GetString(normSrcPtr), -1, &srcString);
Tcl_WinUtfToTChar(Tcl_GetString(normDestPtr), -1, &dstString);
ret = TraverseWinTree(TraversalCopy, &srcString, &dstString, &ds);
@@ -996,6 +1000,9 @@ TclpObjRemoveDirectory(
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);
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 196c7ac..03ccf9d 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.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: tclWinFile.c,v 1.85 2006/03/14 19:34:30 vincentdarley Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.86 2006/08/29 00:36:57 coldstore Exp $
*/
/* #define _WIN32_WINNT 0x0500 */
@@ -2483,13 +2483,11 @@ TclpObjLink(
int linkAction)
{
if (toPtr != NULL) {
+ toPtr = Tcl_FSGetNormalizedPath(NULL, toPtr);
+ }
+ if (toPtr != NULL) {
int res;
-#if 0
TCHAR *LinkTarget = (TCHAR *) Tcl_FSGetNativePath(toPtr);
-#else
- TCHAR *LinkTarget = (TCHAR *) Tcl_FSGetNativePath(
- Tcl_FSGetNormalizedPath(NULL, toPtr));
-#endif
TCHAR *LinkSource = (TCHAR *) Tcl_FSGetNativePath(pathPtr);
if (LinkSource == NULL || LinkTarget == NULL) {
@@ -3256,12 +3254,18 @@ TclNativeCreateNativeRep(
*/
validPathPtr = Tcl_FSGetTranslatedPath(NULL, pathPtr);
+ if (validPathPtr == NULL) {
+ return NULL;
+ }
} else {
/*
* Make sure the normalized path is set.
*/
validPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
+ if (validPathPtr == NULL) {
+ return NULL;
+ }
Tcl_IncrRefCount(validPathPtr);
}