Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22453
Modified Files: Tag: impd_0_37 t_tkcmd.c Log Message: trapping buffer overflow; detailed tcl error messages
Index: t_tkcmd.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/t_tkcmd.c,v retrieving revision 1.1.1.4.4.1 retrieving revision 1.1.1.4.4.2 diff -C2 -d -r1.1.1.4.4.1 -r1.1.1.4.4.2 *** t_tkcmd.c 23 Feb 2004 02:46:52 -0000 1.1.1.4.4.1 --- t_tkcmd.c 13 Mar 2004 07:18:18 -0000 1.1.1.4.4.2 *************** *** 292,296 **** if (result != TCL_OK) { ! if (*tk_myinterp->result) printf("%s\n", tk_myinterp->result); } } --- 292,298 ---- if (result != TCL_OK) { ! if (*tk_myinterp->result) { ! Tcl_Eval(tk_myinterp, "global errorInfo; puts stderr "Tcl Error: $errorInfo""); ! } } } *************** *** 299,309 **** void tcl_vmess(char *fmt, ...) { ! int result, i; char buf[MAXWRITE]; va_list ap;
va_start(ap, fmt); ! ! vsprintf(buf, fmt, ap); result = Tcl_Eval(tk_myinterp, buf); if (result != TCL_OK) --- 301,314 ---- void tcl_vmess(char *fmt, ...) { ! int result, n; char buf[MAXWRITE]; va_list ap;
va_start(ap, fmt); ! n = vsnprintf(buf, sizeof(buf), fmt, ap); ! if (n>=sizeof(buf)) { ! fprintf(stderr,"tcl_vmess: buffer overflow!\n"); ! abort(); /* AAAAAH! */ ! } result = Tcl_Eval(tk_myinterp, buf); if (result != TCL_OK)