summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-11-28 16:50:27 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-11-28 16:50:27 (GMT)
commitef2fd068309b48838e525926dbffc6468ac3359b (patch)
treebc4ed0552bd2f788798f9ccef186a65ad0abc030 /generic
parente5d536c1d7d013348751b3d4b691d1fa772fe65a (diff)
downloadtcl-ef2fd068309b48838e525926dbffc6468ac3359b.zip
tcl-ef2fd068309b48838e525926dbffc6468ac3359b.tar.gz
tcl-ef2fd068309b48838e525926dbffc6468ac3359b.tar.bz2
* generic/tclNamesp.c (Tcl_SetEnsembleMappingDict): Added checks
that the dict value passed in is in the format required to make the internals of ensembles work.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclNamesp.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index d8023a7..d4c12a8 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -23,7 +23,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNamesp.c,v 1.158 2007/11/21 14:30:34 dkf Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.159 2007/11/28 16:50:27 dgp Exp $
*/
#include "tclInt.h"
@@ -5407,11 +5407,33 @@ Tcl_SetEnsembleMappingDict(
return TCL_ERROR;
}
if (mapDict != NULL) {
- int size;
+ int size, done;
+ Tcl_DictSearch search;
+ Tcl_Obj *valuePtr;
if (Tcl_DictObjSize(interp, mapDict, &size) != TCL_OK) {
return TCL_ERROR;
}
+
+ for (Tcl_DictObjFirst(NULL, mapDict, &search, NULL, &valuePtr, &done);
+ !done; Tcl_DictObjNext(&search, NULL, &valuePtr, &done)) {
+ Tcl_Obj *cmdPtr;
+ const char *bytes;
+
+ if (Tcl_ListObjIndex(interp, valuePtr, 0, &cmdPtr) != TCL_OK) {
+ Tcl_DictObjDone(&search);
+ return TCL_ERROR;
+ }
+ bytes = TclGetString(cmdPtr);
+ if (bytes[0] != ':' || bytes[1] != ':') {
+ Tcl_AppendResult(interp,
+ "ensemble target is not a fully-qualified command",
+ NULL);
+ Tcl_DictObjDone(&search);
+ return TCL_ERROR;
+ }
+ }
+
if (size < 1) {
mapDict = NULL;
}