summaryrefslogtreecommitdiffstats
path: root/generic/tkWindow.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-04-04 18:01:17 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-04-04 18:01:17 (GMT)
commit178f09ee754d6c182457f11aa4b85b96e872f127 (patch)
treef488502bf2d14b2e02f3ec5ffae06b7e04c43295 /generic/tkWindow.c
parent9f7f483211dbdf87338b70ec05942fbd7cca8b0f (diff)
parentc5eb851f8387eb5fc52c3ab493c72f3e3d3f5f45 (diff)
downloadtk-178f09ee754d6c182457f11aa4b85b96e872f127.zip
tk-178f09ee754d6c182457f11aa4b85b96e872f127.tar.gz
tk-178f09ee754d6c182457f11aa4b85b96e872f127.tar.bz2
Fixed [3512539fff] - .. is silently accepted in widget paths (user: fvogel, tags: bug-3512539fff
Diffstat (limited to 'generic/tkWindow.c')
-rw-r--r--generic/tkWindow.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index b5cbbab..95e431c 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -1173,10 +1173,12 @@ Tk_CreateWindowFromPath(
/*
* Strip the parent's name out of pathName (it's everything up to the last
- * dot). There are two tricky parts: (a) must copy the parent's name
+ * dot). There are three tricky parts: (a) must copy the parent's name
* somewhere else to avoid modifying the pathName string (for large names,
* space for the copy will have to be malloc'ed); (b) must special-case
- * the situation where the parent is ".".
+ * the situation where the parent is "."; (c) the parent's name cannot be
+ * only 1 character long because it should include both a leading dot and
+ * at least one additional character.
*/
p = strrchr(pathName, '.');
@@ -1195,6 +1197,11 @@ Tk_CreateWindowFromPath(
if (numChars == 0) {
*p = '.';
p[1] = '\0';
+ } else if (numChars == 1) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad window path name \"%s\"", pathName));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL);
+ return NULL;
} else {
strncpy(p, pathName, (size_t) numChars);
p[numChars] = '\0';