summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixChan.c
diff options
context:
space:
mode:
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));