diff options
| author | dgp <dgp@users.sourceforge.net> | 2020-04-22 22:18:53 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2020-04-22 22:18:53 (GMT) |
| commit | 3b1c00722a2401b6c4a6f80044364f6365da9749 (patch) | |
| tree | c8b6c768062bec21c4acbe32f87830ee8b20214a /generic/tclTest.c | |
| parent | 7f1a39781fafdf8fc0e10176a7fed4e0713a8866 (diff) | |
| download | tcl-3b1c00722a2401b6c4a6f80044364f6365da9749.zip tcl-3b1c00722a2401b6c4a6f80044364f6365da9749.tar.gz tcl-3b1c00722a2401b6c4a6f80044364f6365da9749.tar.bz2 | |
Collection of tests checking read limit protections calling Tcl_UtfNext.
Diffstat (limited to 'generic/tclTest.c')
| -rw-r--r-- | generic/tclTest.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index 76a827a..d00c852 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -7138,7 +7138,7 @@ TestUtfNextCmd( bytes = (char *) Tcl_GetByteArrayFromObj(objv[1], &numBytes); - offset = numBytes + TCL_UTF_MAX; /* If no constraint is given, allow + offset = numBytes +TCL_UTF_MAX -1; /* If no constraint is given, allow * the terminating NUL to limit * operations. */ @@ -7149,12 +7149,12 @@ TestUtfNextCmd( if (offset < 0) { offset = 0; } - if (offset > numBytes + TCL_UTF_MAX) { - offset = numBytes + TCL_UTF_MAX; + if (offset > numBytes +TCL_UTF_MAX -1) { + offset = numBytes +TCL_UTF_MAX -1; } } - if (numBytes > sizeof(buffer)-2) { + if (numBytes > sizeof(buffer) - 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "\"testutfnext\" can only handle %d bytes", sizeof(buffer) - 2)); |
