diff options
author | coldstore <coldstore> | 2006-08-29 00:36:57 (GMT) |
---|---|---|
committer | coldstore <coldstore> | 2006-08-29 00:36:57 (GMT) |
commit | 4ddcec561c505418f8a373d83ac40a7c31782b15 (patch) | |
tree | fbb2d67db8ec91bfa4da2a93652e5717dcaf4984 /generic | |
parent | c247e59a168cf578e7dad192eb8a2a8c5f11ab64 (diff) | |
download | tcl-4ddcec561c505418f8a373d83ac40a7c31782b15.zip tcl-4ddcec561c505418f8a373d83ac40a7c31782b15.tar.gz tcl-4ddcec561c505418f8a373d83ac40a7c31782b15.tar.bz2 |
fixed [ 1548263 ] NULL return from Tcl_FSGetNormalizedPath segv
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIOUtil.c | 24 | ||||
-rw-r--r-- | generic/tclPathObj.c | 6 |
2 files changed, 17 insertions, 13 deletions
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; } |