From 8bd505ac8349a223aa3abad60887b222c52eb0ec Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 16 Jul 2020 13:42:57 +0000 Subject: Fix [5bbd044812]: Fix index underflow. --- generic/tclFileName.c | 4 ++-- 1 file 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); } -- cgit v0.12