summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixChan.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-30 22:22:32 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-30 22:22:32 (GMT)
commitfeac96c8b3c738ef7cb8e3e89e076aa4f23f13b0 (patch)
tree196f438c5ba746829c249ad28e10c94a4a44ee0c /unix/tclUnixChan.c
parent67ced520761d9c2dff0022dafbebdb996e20b551 (diff)
parented24f448c79bc5af4c0f6fd77826a6552271dd9c (diff)
downloadtcl-feac96c8b3c738ef7cb8e3e89e076aa4f23f13b0.zip
tcl-feac96c8b3c738ef7cb8e3e89e076aa4f23f13b0.tar.gz
tcl-feac96c8b3c738ef7cb8e3e89e076aa4f23f13b0.tar.bz2
Merge 8.7
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r--unix/tclUnixChan.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index b81676e..92ddcd3 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -1009,7 +1009,7 @@ TtyGetOptionProc(
valid = 1;
TtyGetAttributes(fsPtr->fileState.fd, &tty);
- sprintf(buf, "%d,%c,%d,%d", tty.baud, tty.parity, tty.data, tty.stop);
+ snprintf(buf, sizeof(buf), "%d,%c,%d,%d", tty.baud, tty.parity, tty.data, tty.stop);
Tcl_DStringAppendElement(dsPtr, buf);
}
@@ -1055,9 +1055,9 @@ TtyGetOptionProc(
inBuffered = Tcl_InputBuffered(fsPtr->fileState.channel);
outBuffered = Tcl_OutputBuffered(fsPtr->fileState.channel);
- sprintf(buf, "%d", inBuffered+inQueue);
+ snprintf(buf, sizeof(buf), "%d", inBuffered+inQueue);
Tcl_DStringAppendElement(dsPtr, buf);
- sprintf(buf, "%d", outBuffered+outQueue);
+ snprintf(buf, sizeof(buf), "%d", outBuffered+outQueue);
Tcl_DStringAppendElement(dsPtr, buf);
}
@@ -1096,9 +1096,9 @@ TtyGetOptionProc(
}
return TCL_ERROR;
}
- sprintf(buf, "%d", ws.ws_col);
+ snprintf(buf, sizeof(buf), "%d", ws.ws_col);
Tcl_DStringAppendElement(dsPtr, buf);
- sprintf(buf, "%d", ws.ws_row);
+ snprintf(buf, sizeof(buf), "%d", ws.ws_row);
Tcl_DStringAppendElement(dsPtr, buf);
}
#endif /* TIOCGWINSZ */
@@ -1653,13 +1653,13 @@ TclpOpenFileChannel(
translation = "auto crlf";
channelTypePtr = &ttyChannelType;
TtyInit(fd);
- sprintf(channelName, "serial%d", fd);
+ snprintf(channelName, sizeof(channelName), "serial%d", fd);
} else
#endif /* SUPPORTS_TTY */
{
translation = NULL;
channelTypePtr = &fileChannelType;
- sprintf(channelName, "file%d", fd);
+ snprintf(channelName, sizeof(channelName), "file%d", fd);
}
fsPtr = (TtyState *)Tcl_Alloc(sizeof(TtyState));
@@ -1730,7 +1730,7 @@ Tcl_MakeFileChannel(
#ifdef SUPPORTS_TTY
if (isatty(fd)) {
channelTypePtr = &ttyChannelType;
- sprintf(channelName, "serial%d", fd);
+ snprintf(channelName, sizeof(channelName), "serial%d", fd);
} else
#endif /* SUPPORTS_TTY */
if (fstat(fd, &buf) == 0 && S_ISSOCK(buf.st_mode)) {
@@ -1748,7 +1748,7 @@ Tcl_MakeFileChannel(
} else {
normalChannelAfterAll:
channelTypePtr = &fileChannelType;
- sprintf(channelName, "file%d", fd);
+ snprintf(channelName, sizeof(channelName), "file%d", fd);
}
fsPtr = (TtyState *)Tcl_Alloc(sizeof(TtyState));