diff options
| author | dkf <donal.k.fellows@manchester.ac.uk> | 2023-05-24 16:02:24 (GMT) |
|---|---|---|
| committer | dkf <donal.k.fellows@manchester.ac.uk> | 2023-05-24 16:02:24 (GMT) |
| commit | 29225e440c7dfc3b4fb54d8bb5a8b32fd9604d6f (patch) | |
| tree | 76a21d1b72f69d7f7218eb0332f9d2afbed472d5 /unix/tclUnixChan.c | |
| parent | 4a3c559932945a74fed481561274ceedc4afe555 (diff) | |
| parent | 70a3d08fc4eb639c20c5613ea5952a0dfdd5e935 (diff) | |
| download | tcl-29225e440c7dfc3b4fb54d8bb5a8b32fd9604d6f.zip tcl-29225e440c7dfc3b4fb54d8bb5a8b32fd9604d6f.tar.gz tcl-29225e440c7dfc3b4fb54d8bb5a8b32fd9604d6f.tar.bz2 | |
merge core-8-branch
Diffstat (limited to 'unix/tclUnixChan.c')
| -rw-r--r-- | unix/tclUnixChan.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 3751d6e..f9a054a 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -1250,7 +1250,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); } @@ -1296,9 +1296,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); } @@ -1337,9 +1337,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 */ @@ -1705,7 +1705,7 @@ TtyParseMode( * * We cannot if/else/endif the strchr arguments, it has to be the whole * function. On AIX this function is apparently a macro, and macros do - * not allow pre-processor directives in their arguments. + * not allow preprocessor directives in their arguments. */ if ( @@ -1894,13 +1894,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 *)ckalloc(sizeof(TtyState)); @@ -1955,7 +1955,7 @@ TclpOpenFileChannel( Tcl_Channel Tcl_MakeFileChannel( void *handle, /* OS level handle. */ - int mode) /* ORed combination of TCL_READABLE and + int mode) /* OR'ed combination of TCL_READABLE and * TCL_WRITABLE to indicate file mode. */ { TtyState *fsPtr; @@ -1974,7 +1974,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 ((getsockname(fd, (struct sockaddr *) &sockaddr, &sockaddrLen) == 0) @@ -1984,7 +1984,7 @@ Tcl_MakeFileChannel( return (Tcl_Channel)TclpMakeTcpClientChannelMode(INT2PTR(fd), mode); } else { channelTypePtr = &fileChannelType; - sprintf(channelName, "file%d", fd); + snprintf(channelName, sizeof(channelName), "file%d", fd); } fsPtr = (TtyState *)ckalloc(sizeof(TtyState)); |
