summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2020-07-16 15:34:57 (GMT)
committersebres <sebres@users.sourceforge.net>2020-07-16 15:34:57 (GMT)
commit565b9dca95a5103374909c089697e655748cc932 (patch)
tree143dfad569805855c5995ede222634ec640f0380
parent932835c1ebe010e7c12090fc2a09d00170c641ba (diff)
downloadtcl-565b9dca95a5103374909c089697e655748cc932.zip
tcl-565b9dca95a5103374909c089697e655748cc932.tar.gz
tcl-565b9dca95a5103374909c089697e655748cc932.tar.bz2
cherry pick [df5f1e8652]: Fix [5bbd044812]: Fix index underflow.
-rw-r--r--generic/tclFileName.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index a8360fc..be1fdfa 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -2432,7 +2432,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);
}
}
@@ -2469,7 +2469,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);
}