summaryrefslogtreecommitdiffstats
path: root/generic/tclFileName.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-16 13:42:57 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-16 13:42:57 (GMT)
commit80956091769b58a835413059810b4abb519e0fc7 (patch)
tree5beacce419d5f1429b9d8be32cd604e88e21476e /generic/tclFileName.c
parent6b246d7f4c891e8152b178b6c85346f8b0247c94 (diff)
downloadtcl-80956091769b58a835413059810b4abb519e0fc7.zip
tcl-80956091769b58a835413059810b4abb519e0fc7.tar.gz
tcl-80956091769b58a835413059810b4abb519e0fc7.tar.bz2
Fix [5bbd044812]: Fix index underflow.
Diffstat (limited to 'generic/tclFileName.c')
-rw-r--r--generic/tclFileName.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 8fb9f4d..f7de10c 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -2448,7 +2448,7 @@ DoGlob(
int len;
const char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
- if (strchr(separators, joined[len-1]) == NULL) {
+ if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
Tcl_AppendToObj(joinedPtr, "/", 1);
}
}
@@ -2485,7 +2485,7 @@ DoGlob(
int len;
const char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
- if (strchr(separators, joined[len-1]) == NULL) {
+ if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) {
Tcl_AppendToObj(joinedPtr, "/", 1);
}