From dc4a6bd185824428dbdbeb43e9ef2888dd8da7c8 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Tue, 24 Apr 2007 17:18:10 +0000 Subject: * generic/tclBinary.c: Addressed several code paths where the error return from the 'binary format' command leaked the result buffer. --- ChangeLog | 6 ++++++ generic/tclBinary.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8e00089..d0eabf3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-04-24 Kevin B. Kenny + + * generic/tclBinary.c: Addressed several code paths where the + error return from the 'binary format' command leaked the result + buffer. + 2007-04-24 Jeff Hobbs *** 8.5a6 TAGGED FOR RELEASE *** diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 485383a..0512739 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.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: tclBinary.c,v 1.34 2007/03/19 21:00:53 dgp Exp $ + * RCS: @(#) $Id: tclBinary.c,v 1.35 2007/04/24 17:18:11 kennykb Exp $ */ #include "tclInt.h" @@ -829,6 +829,7 @@ Tcl_BinaryObjCmd( value |= 1; } else if (str[offset] != '0') { errorValue = str; + Tcl_DecrRefCount(resultPtr); goto badValue; } if (((offset + 1) % 8) == 0) { @@ -843,6 +844,7 @@ Tcl_BinaryObjCmd( value |= 128; } else if (str[offset] != '0') { errorValue = str; + Tcl_DecrRefCount(resultPtr); goto badValue; } if (!((offset + 1) % 8)) { @@ -886,6 +888,7 @@ Tcl_BinaryObjCmd( value <<= 4; if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */ errorValue = str; + Tcl_DecrRefCount(resultPtr); goto badValue; } c = str[offset] - '0'; @@ -907,6 +910,7 @@ Tcl_BinaryObjCmd( if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */ errorValue = str; + Tcl_DecrRefCount(resultPtr); goto badValue; } c = str[offset] - '0'; @@ -975,6 +979,7 @@ Tcl_BinaryObjCmd( arg++; for (i = 0; i < count; i++) { if (FormatNumber(interp, cmd, listv[i], &cursor)!=TCL_OK) { + Tcl_DecrRefCount(resultPtr); return TCL_ERROR; } } -- cgit v0.12