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/tclIOUtil.c | |
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/tclIOUtil.c')
-rw-r--r-- | generic/tclIOUtil.c | 24 |
1 files changed, 13 insertions, 11 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. |