diff options
author | fvogel <fvogelnew1@free.fr> | 2016-03-23 16:55:30 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2016-03-23 16:55:30 (GMT) |
commit | d9a6a00d31a183d425194924b689789e608dc7aa (patch) | |
tree | dc38ab00d74e214d8c2762228887a2e4d89a1835 /generic | |
parent | 80c74be24faeeddbe71c2078229afbde8d89e3dc (diff) | |
download | tk-d9a6a00d31a183d425194924b689789e608dc7aa.zip tk-d9a6a00d31a183d425194924b689789e608dc7aa.tar.gz tk-d9a6a00d31a183d425194924b689789e608dc7aa.tar.bz2 |
Fixed [3512539fff] - .. is silently accepted in widget paths
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkWindow.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c index b5cbbab..3797c23 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 characters. */ 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'; |