summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclFileName.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 78a39c7..689e79a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-27 Miguel Sofer <msofer@users.sf.net>
+
+ * generic/tclFileName.c (TclGlob): added a panic for a call with
+ TCL_GLOBMODE_TAILS and pathPrefix==NULL. This would cause a
+ segfault, as found by coverity #26.
+
2006-09-26 Kevin Kenny <kennykb@acm.org>
* doc/Encoding.3: Added covariant 'const' qualifier for the
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index ec872d0..590c180 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.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: tclFileName.c,v 1.75 2006/08/30 17:56:57 hobbs Exp $
+ * RCS: @(#) $Id: tclFileName.c,v 1.76 2006/09/27 13:49:06 msofer Exp $
*/
#include "tclInt.h"
@@ -1894,12 +1894,17 @@ TclGlob(
int objc, i;
Tcl_Obj **objv;
int prefixLen;
+ CONST char *pre;
/*
* If this length has never been set, set it here.
*/
- CONST char *pre = Tcl_GetStringFromObj(pathPrefix, &prefixLen);
+ if (pathPrefix == NULL) {
+ Tcl_Panic("Called TclGlob with TCL_GLOBMODE_TAILS and pathPrefix==NULL");
+ }
+
+ pre = Tcl_GetStringFromObj(pathPrefix, &prefixLen);
if (prefixLen > 0
&& (strchr(separators, pre[prefixLen-1]) == NULL)) {
/*