summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
authordgp@users.sourceforge.net <dgp>2003-11-05 20:52:38 (GMT)
committerdgp@users.sourceforge.net <dgp>2003-11-05 20:52:38 (GMT)
commitdd20d60837242af01e4e78a0528209831dd5c345 (patch)
treeb9b6cfff34bf9f514e751d6b1bdedf8ff7de4c0f /generic/tclEncoding.c
parent0ba68a4fb7ae6728cf361ad718185f55d5719a25 (diff)
downloadtcl-dd20d60837242af01e4e78a0528209831dd5c345.zip
tcl-dd20d60837242af01e4e78a0528209831dd5c345.tar.gz
tcl-dd20d60837242af01e4e78a0528209831dd5c345.tar.bz2
* generic/tclEncoding.c (TclFindEncodings): Normalize the path
of the executable before passing to TclpInitLibraryPath() to avoid buggy handling of paths containing "..". [Bug 832657] * tests/unixInit.test (unixInit-2.10): New test for fixed bug.
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 576a479..87f4669 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEncoding.c,v 1.16 2003/02/21 02:40:58 hobbs Exp $
+ * RCS: @(#) $Id: tclEncoding.c,v 1.16.2.1 2003/11/05 20:52:39 dgp Exp $
*/
#include "tclInt.h"
@@ -2827,8 +2827,7 @@ TclFindEncodings(argv0)
CONST char *argv0; /* Name of executable from argv[0] to main()
* in native multi-byte encoding. */
{
- char *native;
- Tcl_Obj *pathPtr;
+ Tcl_Obj *pathPtr, *normPtr;
Tcl_DString libPath, buffer;
if (encodingsInitialized == 0) {
@@ -2846,8 +2845,13 @@ TclFindEncodings(argv0)
encodingsInitialized = 1;
- native = TclpFindExecutable(argv0);
- TclpInitLibraryPath(native);
+ pathPtr = Tcl_NewStringObj(TclpFindExecutable(argv0), -1);
+ Tcl_IncrRefCount(pathPtr);
+ normPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
+ Tcl_IncrRefCount(normPtr);
+ Tcl_DecrRefCount(pathPtr);
+ TclpInitLibraryPath(Tcl_GetString(normPtr));
+ Tcl_DecrRefCount(normPtr);
/*
* The library path was set in the TclpInitLibraryPath routine.