diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-10-19 21:26:19 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-10-19 21:26:19 (GMT) |
commit | b976a2d33c9aa2468e47c3886301b27975e1ce15 (patch) | |
tree | e3aa1e4d8e3c51e574e745c55d03d85ef9ec6966 | |
parent | 91a8a2453afae40f8b0ea245f5ad809cc58cb829 (diff) | |
download | tcl-b976a2d33c9aa2468e47c3886301b27975e1ce15.zip tcl-b976a2d33c9aa2468e47c3886301b27975e1ce15.tar.gz tcl-b976a2d33c9aa2468e47c3886301b27975e1ce15.tar.bz2 |
Fix crash caused by passing -1 as the length to TclNewStringObj(). Only
Tcl_NewStringObj (the function call, not the macro) handles that sort of
thing correctly.
-rw-r--r-- | generic/tclIORChan.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index d665dba..2e4b192 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIORChan.c,v 1.10 2005/10/19 14:12:35 dkf Exp $ + * RCS: @(#) $Id: tclIORChan.c,v 1.11 2005/10/19 21:26:19 dkf Exp $ */ #include <tclInt.h> @@ -359,26 +359,21 @@ static void DstExitProc(ClientData clientData); } #define PassReceivedErrorInterp(i,p) \ if ((i) != NULL) { \ - Tcl_Obj *preiTmpObj; \ - TclNewStringObj(preiTmpObj, (p)->base.msgStr, -1); \ - Tcl_SetChannelErrorInterp((i), preiTmpObj); \ + Tcl_SetChannelErrorInterp((i), \ + Tcl_NewStringObj((p)->base.msgStr, -1)); \ } \ FreeReceivedError(p) #define PassReceivedError(c,p) \ - { \ - Tcl_Obj *preTmpObj; \ - TclNewStringObj(preTmpObj, (p)->base.msgStr, -1); \ - Tcl_SetChannelError((c), preTmpObj); \ - FreeReceivedError(p); \ - } + Tcl_SetChannelError((c), Tcl_NewStringObj((p)->base.msgStr, -1)); \ + FreeReceivedError(p) #define ForwardSetStaticError(p,emsg) \ (p)->base.code = TCL_ERROR; \ (p)->base.mustFree = 0; \ - (p)->base.msgStr = (char *) (emsg); + (p)->base.msgStr = (char *) (emsg) #define ForwardSetDynamicError(p,emsg) \ (p)->base.code = TCL_ERROR; \ (p)->base.mustFree = 1; \ - (p)->base.msgStr = (char *) (emsg); + (p)->base.msgStr = (char *) (emsg) static void ForwardSetObjError(ForwardParam *p, Tcl_Obj *objPtr); |