From 4b8109368625d2b5d9c74f7f2375925b57860efa Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 25 Aug 2015 11:29:58 +0000 Subject: Fix [0df7a1ec2674a76a]: unix/tclUnixFile.c: return value of call to TclpGetCwd in TclpFindExecutable is not checked, variable cwd is used uninitialized. --- unix/tclUnixFile.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index c5f75a7..0a2099c 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); -- cgit v0.12