diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBinary.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 75b3ca2..042cbed 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.58 2009/12/11 23:10:47 nijtmans Exp $ + * RCS: @(#) $Id: tclBinary.c,v 1.59 2009/12/29 01:43:23 patthoyts Exp $ */ #include "tclInt.h" @@ -2309,6 +2309,7 @@ BinaryDecodeHex( *cursor++ = UCHAR(value); value = 0; } + if (cut > size) cut = size; Tcl_SetByteArrayLength(resultObj, cursor - begin - cut); Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -2515,6 +2516,7 @@ BinaryDecodeUu( *cursor++ = (((d[2] - 0x20) & 0x3f) << 6) | (((d[3] - 0x20) & 0x3f)); } + if (cut > size) cut = size; Tcl_SetByteArrayLength(resultObj, cursor - begin - cut); Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -2620,6 +2622,7 @@ BinaryDecode64( *cursor++ = UCHAR((value >> 8) & 0xff); *cursor++ = UCHAR(value & 0xff); } + if (cut > size) cut = size; Tcl_SetByteArrayLength(resultObj, cursor - begin - cut); Tcl_SetObjResult(interp, resultObj); return TCL_OK; |