--- generic/tclCmdMZ.c	2018-11-16 19:37:34.000000000 +0100
+++ generic/tclCmdMZ.c	2019-09-12 11:28:14.517399747 +0200
@@ -1114,6 +1114,7 @@
 
     } else if (splitCharLen == 1) {
 	char *p;
+	int remainLen;
 
 	/*
 	 * Handle the special case of splitting on a single character. This is
@@ -1121,13 +1122,21 @@
 	 * byte in length.
 	 */
 
-	while (*stringPtr && (p=strchr(stringPtr,(int)*splitChars)) != NULL) {
-	    objPtr = Tcl_NewStringObj(stringPtr, p - stringPtr);
+	remainLen = stringLen;
+	while (remainLen > 0 && (p=memchr(stringPtr,(int)*splitChars,remainLen)) != NULL) {
+	    int chunkLen;
+
+	    chunkLen = p - stringPtr;
+	    objPtr = Tcl_NewStringObj(stringPtr, chunkLen);
 	    Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
 	    stringPtr = p + 1;
+	    remainLen -= chunkLen;
+	}
+
+	if (remainLen >= 0) {
+	    TclNewStringObj(objPtr, stringPtr, remainLen);
+	    Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
 	}
-	TclNewStringObj(objPtr, stringPtr, end - stringPtr);
-	Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
     } else {
 	const char *element, *p, *splitEnd;
 	int splitLen;
