summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-25 11:15:48 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-25 11:15:48 (GMT)
commit00a4f18c383b2b24cb09871621ff49f7ea98e758 (patch)
tree01ef1c109e44a59df93b2679d9e8df2ea143487d
parent8f0b94f037c765b9068d39a7f3d7a0f69ed2d3de (diff)
parent9d34b872ced6c6713cf84f914f11a017ecd2cd49 (diff)
downloadtcl-00a4f18c383b2b24cb09871621ff49f7ea98e758.zip
tcl-00a4f18c383b2b24cb09871621ff49f7ea98e758.tar.gz
tcl-00a4f18c383b2b24cb09871621ff49f7ea98e758.tar.bz2
When sourcing script files (even when simulating that through open|read), always set -eofchar \032 just like the source command does.
Possible security issue: this could make it possible to evaluate hidden content at the end of pkgIndex files.
-rw-r--r--generic/tclProc.c2
-rw-r--r--library/auto.tcl2
-rw-r--r--library/init.tcl1
3 files changed, 4 insertions, 1 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 56757ff..769074b 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -903,7 +903,7 @@ TclNRUplevelObjCmd(
Tcl_Obj *objPtr;
if (objc < 2) {
- /* to do
+ /* to do
* simplify things by interpreting the argument as a command when there
* is only one argument. This requires a TIP since currently a single
* argument is interpreted as a level indicator if possible.
diff --git a/library/auto.tcl b/library/auto.tcl
index 825aeeb..64c5bc7 100644
--- a/library/auto.tcl
+++ b/library/auto.tcl
@@ -240,6 +240,7 @@ proc auto_mkindex_old {dir args} {
set f ""
set error [catch {
set f [open $file]
+ fconfigure $f -eofchar \032
while {[gets $f line] >= 0} {
if {[regexp {^proc[ ]+([^ ]*)} $line match procName]} {
set procName [lindex [auto_qualify $procName "::"] 0]
@@ -350,6 +351,7 @@ proc auto_mkindex_parser::mkindex {file} {
set scriptFile $file
set fid [open $file]
+ fconfigure $fid -eofchar \032
set contents [read $fid]
close $fid
diff --git a/library/init.tcl b/library/init.tcl
index 1028b9e..da1850c 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -494,6 +494,7 @@ proc auto_load_index {} {
continue
} else {
set error [catch {
+ fconfigure $f -eofchar \032
set id [gets $f]
if {$id eq "# Tcl autoload index file, version 2.0"} {
eval [read $f]