diff options
author | dgp <dgp@users.sourceforge.net> | 2020-04-01 20:14:40 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2020-04-01 20:14:40 (GMT) |
commit | a5117fe2c364b595a7287d6a14bfe5b7b28ec959 (patch) | |
tree | e55e53a8dee79e04b1008829fc2ae23fddf33e09 /generic | |
parent | bf0697812e57a8a96fc943cb53a6ecd55e37b767 (diff) | |
download | tcl-a5117fe2c364b595a7287d6a14bfe5b7b28ec959.zip tcl-a5117fe2c364b595a7287d6a14bfe5b7b28ec959.tar.gz tcl-a5117fe2c364b595a7287d6a14bfe5b7b28ec959.tar.bz2 |
Prevent a binary read appending to a non-bytes value.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIO.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index edce09b..0e80fd5 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -5862,7 +5862,11 @@ DoReadChars( && (statePtr->inputTranslation == TCL_TRANSLATE_LF) && (statePtr->inEofChar == '\0'); - if (appendFlag == 0) { + if (appendFlag) { + if (binaryMode && (NULL == TclGetBytesFromObj(NULL, objPtr, NULL))) { + binaryMode = 0; + } + } else { if (binaryMode) { Tcl_SetByteArrayLength(objPtr, 0); } else { |