summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-05 16:05:36 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-05 16:05:36 (GMT)
commitfc9cd641eb779a5038416f122c6d0da0949cbbcb (patch)
tree73c640eb4140eec8667af575680ede04aee633a3
parent4df4a598eb231cdc6d925b2330d883786b448e71 (diff)
downloadtcl-fc9cd641eb779a5038416f122c6d0da0949cbbcb.zip
tcl-fc9cd641eb779a5038416f122c6d0da0949cbbcb.tar.gz
tcl-fc9cd641eb779a5038416f122c6d0da0949cbbcb.tar.bz2
Make sure that infoPtr->validMask only contains TCL_READABLE|TCL_WRITABLE|TCL_EXCEPTION, no other flags
-rw-r--r--win/tclWinChan.c6
-rw-r--r--win/tclWinSerial.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 8a4db89..93596ee 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -1092,7 +1092,7 @@ Tcl_MakeFileChannel(
TclFile readFile = NULL, writeFile = NULL;
BOOL result;
- if (mode == 0) {
+ if ((mode & (TCL_READABLE|TCL_WRITABLE)) == 0) {
return NULL;
}
@@ -1375,7 +1375,7 @@ OpenFileChannel(
for (infoPtr = tsdPtr->firstFilePtr; infoPtr != NULL;
infoPtr = infoPtr->nextPtr) {
if (infoPtr->handle == (HANDLE) handle) {
- return (permissions==infoPtr->validMask) ? infoPtr->channel : NULL;
+ return ((permissions & (TCL_READABLE|TCL_WRITABLE|TCL_EXCEPTION))==infoPtr->validMask) ? infoPtr->channel : NULL;
}
}
@@ -1388,7 +1388,7 @@ OpenFileChannel(
*/
infoPtr->nextPtr = NULL;
- infoPtr->validMask = permissions;
+ infoPtr->validMask = permissions & (TCL_READABLE|TCL_WRITABLE|TCL_EXCEPTION);
infoPtr->watchMask = 0;
infoPtr->flags = appendMode;
infoPtr->handle = handle;
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index 62af1c5..a55a23f 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -1458,7 +1458,7 @@ TclWinOpenSerialChannel(
infoPtr = (SerialInfo *)ckalloc(sizeof(SerialInfo));
memset(infoPtr, 0, sizeof(SerialInfo));
- infoPtr->validMask = permissions;
+ infoPtr->validMask = permissions & (TCL_READABLE|TCL_WRITABLE);
infoPtr->handle = handle;
infoPtr->channel = (Tcl_Channel) NULL;
infoPtr->readable = 0;