summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixFile.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-08-25 11:35:01 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-08-25 11:35:01 (GMT)
commit570eb6b10d4d79e67bbca7dc36edceed219b8308 (patch)
treefd67c4df954da5d9030c959d0668dbc513b0c22b /unix/tclUnixFile.c
parent63ba958fe4fef7f35f4d601c27b796ab8f32cc06 (diff)
parentf08cbe00fd1ac3c0a36e15bcc98778d4c5c12679 (diff)
downloadtcl-570eb6b10d4d79e67bbca7dc36edceed219b8308.zip
tcl-570eb6b10d4d79e67bbca7dc36edceed219b8308.tar.gz
tcl-570eb6b10d4d79e67bbca7dc36edceed219b8308.tar.bz2
Fix [0df7a1ec2674a76a]: unix/tclUnixFile.c: return value of call to TclpGetCwd in TclpFindExecutable is not checked, variable cwd is used uninitialized.
Diffstat (limited to 'unix/tclUnixFile.c')
-rw-r--r--unix/tclUnixFile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 2cb0027..7ffbf8d 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -155,6 +155,11 @@ TclpFindExecutable(
goto done;
}
+ if (TclpGetCwd(NULL, &cwd) == NULL) {
+ TclSetObjNameOfExecutable(Tcl_NewObj(), NULL);
+ goto done;
+ }
+
/*
* The name is relative to the current working directory. First strip off
* a leading "./", if any, then add the full path name of the current
@@ -168,8 +173,6 @@ TclpFindExecutable(
Tcl_DStringInit(&nameString);
Tcl_DStringAppend(&nameString, name, -1);
- TclpGetCwd(NULL, &cwd);
-
Tcl_DStringFree(&buffer);
Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&cwd),
Tcl_DStringLength(&cwd), &buffer);