summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-04-01 20:14:40 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-04-01 20:14:40 (GMT)
commita5117fe2c364b595a7287d6a14bfe5b7b28ec959 (patch)
treee55e53a8dee79e04b1008829fc2ae23fddf33e09 /generic/tclIO.c
parentbf0697812e57a8a96fc943cb53a6ecd55e37b767 (diff)
downloadtcl-a5117fe2c364b595a7287d6a14bfe5b7b28ec959.zip
tcl-a5117fe2c364b595a7287d6a14bfe5b7b28ec959.tar.gz
tcl-a5117fe2c364b595a7287d6a14bfe5b7b28ec959.tar.bz2
Prevent a binary read appending to a non-bytes value.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c6
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 {