diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2006-09-27 13:49:05 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2006-09-27 13:49:05 (GMT) |
commit | a14dc8880490ddf17e78d3eacf6e892dd3dd6a67 (patch) | |
tree | b69d2e99baae959ebfca8a6bc3c0d1f4feee743d | |
parent | b725003f03a39521f6ea93c9ee3f7a688eb96674 (diff) | |
download | tcl-a14dc8880490ddf17e78d3eacf6e892dd3dd6a67.zip tcl-a14dc8880490ddf17e78d3eacf6e892dd3dd6a67.tar.gz tcl-a14dc8880490ddf17e78d3eacf6e892dd3dd6a67.tar.bz2 |
* 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.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclFileName.c | 9 |
2 files changed, 13 insertions, 2 deletions
@@ -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)) { /* |