diff options
author | dgp <dgp@noemail.net> | 2003-07-18 23:35:37 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2003-07-18 23:35:37 (GMT) |
commit | c45595142e32e696a7b2d1c60f3642cb5cdb9865 (patch) | |
tree | 0580485f72aa65d80f29849145a21e23f8252d07 /generic/tclProc.c | |
parent | 03888b1fcd8455e662fda1d186eb56b842da94b5 (diff) | |
download | tcl-c45595142e32e696a7b2d1c60f3642cb5cdb9865.zip tcl-c45595142e32e696a7b2d1c60f3642cb5cdb9865.tar.gz tcl-c45595142e32e696a7b2d1c60f3642cb5cdb9865.tar.bz2 |
* generic/tclBasic.c: Corrected several instances of unsafe
* generic/tclCompile.c: truncation of UTF-8 strings that might
* generic/tclProc.c: break apart a multi-byte character.
* library/init.tcl: [Bug 760872]
* tests/init.test:
FossilOrigin-Name: d50fc184389381175baedb204ed4fc23f9e1e0f5
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r-- | generic/tclProc.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c index 4e3d4b8..1ec50f1 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.44 2002/12/11 21:29:52 dgp Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.44.2.1 2003/07/18 23:35:39 dgp Exp $ */ #include "tclInt.h" @@ -1229,6 +1229,14 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName) numChars = 50; ellipsis = "..."; } + while ( (procName[numChars] & 0xC0) == 0x80 ) { + /* + * Back up truncation point so that we don't truncate + * in the middle of a multi-byte character (in UTF-8) + */ + numChars--; + ellipsis = "..."; + } sprintf(buf, "\n (compiling %s \"%.*s%s\", line %d)", description, numChars, procName, ellipsis, interp->errorLine); @@ -1313,6 +1321,14 @@ ProcessProcResultCode(interp, procName, nameLen, returnCode) nameLen = 60; ellipsis = "..."; } + while ( (procName[nameLen] & 0xC0) == 0x80 ) { + /* + * Back up truncation point so that we don't truncate in the + * middle of a multi-byte character (in UTF-8) + */ + nameLen--; + ellipsis = "..."; + } sprintf(msg, "\n (procedure \"%.*s%s\" line %d)", nameLen, procName, ellipsis, iPtr->errorLine); Tcl_AddObjErrorInfo(interp, msg, -1); |