summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrmax <rmax>2006-01-16 19:31:18 (GMT)
committerrmax <rmax>2006-01-16 19:31:18 (GMT)
commitf388a5c71529a9aa4ed00cadbd0551e19c8c32bb (patch)
treebb4d4c02dd4d0a6f73c6f77b2b41e9d00722e46e
parent8fdd6a29a9c9eb192eadf1c481e74db3162cc3d3 (diff)
downloadtcl-f388a5c71529a9aa4ed00cadbd0551e19c8c32bb.zip
tcl-f388a5c71529a9aa4ed00cadbd0551e19c8c32bb.tar.gz
tcl-f388a5c71529a9aa4ed00cadbd0551e19c8c32bb.tar.bz2
* generic/tclPipe.c (FileForRedirect): Prevent nameString from
being freed without having been initialized. * tests/exec.test: Added a test for the above.
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclPipe.c9
-rw-r--r--tests/exec.test8
3 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 0aeb4cc..6b6b24d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-01-16 Reinhard Max <max@suse.de>
+
+ * generic/tclPipe.c (FileForRedirect): Prevent nameString from
+ being freed without having been initialized.
+ * tests/exec.test: Added a test for the above.
+
2006-01-12 Zoran Vasiljevic <vasiljevic@users.sourceforge.net>
* generic/tclIOUtil.c (Tcl_FSGetInternalRep): fixed potential
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index 9750131..accfd62 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.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: tclPipe.c,v 1.7.2.3 2005/10/05 22:09:11 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclPipe.c,v 1.7.2.4 2006/01/16 19:31:18 rmax Exp $
*/
#include "tclInt.h"
@@ -135,11 +135,10 @@ FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr,
*skipPtr = 2;
}
name = Tcl_TranslateFileName(interp, spec, &nameString);
- if (name != NULL) {
- file = TclpOpenFile(name, flags);
- } else {
- file = NULL;
+ if (name == NULL) {
+ return NULL;
}
+ file = TclpOpenFile(name, flags);
Tcl_DStringFree(&nameString);
if (file == NULL) {
Tcl_AppendResult(interp, "couldn't ",
diff --git a/tests/exec.test b/tests/exec.test
index 0dccf37..b4d3216 100644
--- a/tests/exec.test
+++ b/tests/exec.test
@@ -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: exec.test,v 1.16.2.6 2005/11/04 18:33:35 patthoyts Exp $
+# RCS: @(#) $Id: exec.test,v 1.16.2.7 2006/01/16 19:31:19 rmax Exp $
package require tcltest 2
namespace import -force ::tcltest::*
@@ -402,7 +402,11 @@ test exec-10.20 {errors in exec invocation} {exec} {
test exec-10.21 {errors in exec invocation} {exec} {
list [catch {exec [interpreter] true | ~xyzzy_bad_user/x | false} msg] $msg
} {1 {user "xyzzy_bad_user" doesn't exist}}
-
+test exec-10.22 {errors in exec invocation} \
+-constraints exec \
+-returnCodes 1 \
+-body {exec echo test > ~non_existent_user/foo/bar} \
+-result {user "non_existent_user" doesn't exist}
# Commands in background.
test exec-11.1 {commands in background} {exec} {