summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-07-15 21:01:37 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-07-15 21:01:37 (GMT)
commitb4d1044926d12b2792588f9831791c5d99b15ad1 (patch)
treec87f64a57bba9fc6256bdc26e526db8da65478e6 /generic/tclCompCmds.c
parent42d71c633708ecc0a6ad407875b9271906dc43f5 (diff)
downloadtcl-b4d1044926d12b2792588f9831791c5d99b15ad1.zip
tcl-b4d1044926d12b2792588f9831791c5d99b15ad1.tar.gz
tcl-b4d1044926d12b2792588f9831791c5d99b15ad1.tar.bz2
* generic/tclCompCmds.c (TclCompileIfCmd): Prior fix of Bug 711371
on 2003-04-07 introduced a buffer overflow. Corrected. [Bug 771613]
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 139463f..47292f3 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompCmds.c,v 1.49 2003/05/05 20:54:38 dgp Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.50 2003/07/15 21:01:38 dgp Exp $
*/
#include "tclInt.h"
@@ -1195,7 +1195,7 @@ TclCompileIfCmd(interp, parsePtr, envPtr)
if (wordIdx >= numWords) {
sprintf(buffer,
"wrong # args: no expression after \"%.*s\" argument",
- numBytes, word);
+ (numBytes > 50 ? 50 : numBytes), word);
Tcl_ResetResult(interp);
Tcl_AppendToObj(Tcl_GetObjResult(interp), buffer, -1);
code = TCL_ERROR;
@@ -1257,7 +1257,10 @@ TclCompileIfCmd(interp, parsePtr, envPtr)
tokenPtr = testTokenPtr + (testTokenPtr->numComponents + 1);
wordIdx++;
if (wordIdx >= numWords) {
- sprintf(buffer, "wrong # args: no script following \"%.*s\" argument", testTokenPtr->size, testTokenPtr->start);
+ sprintf(buffer,
+ "wrong # args: no script following \"%.*s\" argument",
+ (testTokenPtr->size > 50 ? 50 : testTokenPtr->size),
+ testTokenPtr->start);
Tcl_ResetResult(interp);
Tcl_AppendToObj(Tcl_GetObjResult(interp), buffer, -1);
code = TCL_ERROR;