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)
commit8bd505ac8349a223aa3abad60887b222c52eb0ec (patch)
tree5beacce419d5f1429b9d8be32cd604e88e21476e /generic/tclFileName.c
parent439f72dad506c9f5143db634365aab3375b8c532 (diff)
downloadtcl-8bd505ac8349a223aa3abad60887b222c52eb0ec.zip
tcl-8bd505ac8349a223aa3abad60887b222c52eb0ec.tar.gz
tcl-8bd505ac8349a223aa3abad60887b222c52eb0ec.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);
}