summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-01 10:27:54 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-01 10:27:54 (GMT)
commitbaa549af6a4cd6b4caf71c2f0861ee682cc151d3 (patch)
tree9c50f937fbf7d90f1fc7f249e2581d798d958bfc /unix
parenta30f4dce67cdc3e8e8da693579f8abd90ea22f43 (diff)
parentce04b407d9ed313df659f9d292b91ca65f3e82c4 (diff)
downloadtcl-baa549af6a4cd6b4caf71c2f0861ee682cc151d3.zip
tcl-baa549af6a4cd6b4caf71c2f0861ee682cc151d3.tar.gz
tcl-baa549af6a4cd6b4caf71c2f0861ee682cc151d3.tar.bz2
Merge 9.0
Diffstat (limited to 'unix')
-rw-r--r--unix/dltest/Makefile.in28
-rw-r--r--unix/dltest/embtest.c4
-rw-r--r--unix/dltest/pkga.c2
-rw-r--r--unix/dltest/pkgb.c7
-rw-r--r--unix/dltest/pkgooa.c9
-rw-r--r--unix/dltest/pkgt.c116
-rw-r--r--unix/tclLoadDl.c2
-rw-r--r--unix/tclUnixChan.c18
-rw-r--r--unix/tclUnixInit.c4
-rw-r--r--unix/tclUnixPipe.c6
-rw-r--r--unix/tclUnixSock.c8
-rw-r--r--unix/tclUnixTest.c2
12 files changed, 178 insertions, 28 deletions
diff --git a/unix/dltest/Makefile.in b/unix/dltest/Makefile.in
index 19b7d84..e8dce2f 100644
--- a/unix/dltest/Makefile.in
+++ b/unix/dltest/Makefile.in
@@ -17,7 +17,7 @@ TCL_VERSION= @TCL_VERSION@
CFLAGS_DEBUG = @CFLAGS_DEBUG@
CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@
-CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@ -DTCL_NO_DEPRECATED=1
+CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@ -DTCL_NO_DEPRECATED=1 -Wall -Wextra -Wc++-compat -Wconversion -Werror
LDFLAGS_DEBUG = @LDFLAGS_DEBUG@
LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
LDFLAGS = @LDFLAGS_DEFAULT@ @LDFLAGS@
@@ -26,14 +26,14 @@ CC_SWITCHES = $(CFLAGS) -I${SRC_DIR}/../../generic -DTCL_MEM_DEBUG \
${SHLIB_CFLAGS} -DUSE_TCL_STUBS ${AC_FLAGS}
all: embtest tcl9pkga${SHLIB_SUFFIX} tcl9pkgb${SHLIB_SUFFIX} tcl9pkgc${SHLIB_SUFFIX} \
- tcl9pkgd${SHLIB_SUFFIX} tcl9pkge${SHLIB_SUFFIX} tcl9pkgua${SHLIB_SUFFIX} tcl9pkgooa${SHLIB_SUFFIX} \
- pkga${SHLIB_SUFFIX} pkgb${SHLIB_SUFFIX} pkgc${SHLIB_SUFFIX}
+ tcl9pkgd${SHLIB_SUFFIX} tcl9pkge${SHLIB_SUFFIX} tcl9pkgt${SHLIB_SUFFIX} tcl9pkgua${SHLIB_SUFFIX} \
+ tcl9pkgooa${SHLIB_SUFFIX} pkga${SHLIB_SUFFIX} pkgb${SHLIB_SUFFIX} pkgc${SHLIB_SUFFIX} pkgt${SHLIB_SUFFIX}
@if test -n "$(DLTEST_SUFFIX)"; then $(MAKE) dltest_suffix; fi
@touch ../dltest.marker
dltest_suffix: tcl9pkga${DLTEST_SUFFIX} tcl9pkgb${DLTEST_SUFFIX} tcl9pkgc${DLTEST_SUFFIX} \
- tcl9pkgd${DLTEST_SUFFIX} tcl9pkge${DLTEST_SUFFIX} tcl9pkgua${DLTEST_SUFFIX} tcl9pkgooa${DLTEST_SUFFIX} \
- pkga${DLTEST_SUFFIX} pkgb${DLTEST_SUFFIX} pkgc${DLTEST_SUFFIX}
+ tcl9pkgd${DLTEST_SUFFIX} tcl9pkge${DLTEST_SUFFIX} tcl9pkgt${DLTEST_SUFFIX} tcl9pkgua${DLTEST_SUFFIX} \
+ tcl9pkgooa${DLTEST_SUFFIX} pkga${DLTEST_SUFFIX} pkgb${DLTEST_SUFFIX} pkgc${DLTEST_SUFFIX} pkgt${DLTEST_SUFFIX}
@touch ../dltest.marker
embtest.o: $(SRC_DIR)/embtest.c
@@ -51,6 +51,9 @@ pkgb.o: $(SRC_DIR)/pkgb.c
pkgc.o: $(SRC_DIR)/pkgc.c
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/pkgc.c
+pkgt.o: $(SRC_DIR)/pkgt.c
+ $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/pkgt.c
+
tcl8pkga.o: $(SRC_DIR)/pkga.c
$(CC) -o $@ -c $(CC_SWITCHES) -DTCL_MAJOR_VERSION=8 $(SRC_DIR)/pkga.c
@@ -60,6 +63,9 @@ tcl8pkgb.o: $(SRC_DIR)/pkgb.c
tcl8pkgc.o: $(SRC_DIR)/pkgc.c
$(CC) -o $@ -c $(CC_SWITCHES) -DTCL_MAJOR_VERSION=8 $(SRC_DIR)/pkgc.c
+tcl8pkgt.o: $(SRC_DIR)/pkgt.c
+ $(CC) -o $@ -c $(CC_SWITCHES) -DTCL_MAJOR_VERSION=8 $(SRC_DIR)/pkgt.c
+
pkgd.o: $(SRC_DIR)/pkgd.c
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/pkgd.c
@@ -87,6 +93,9 @@ tcl9pkgb${SHLIB_SUFFIX}: pkgb.o
tcl9pkgc${SHLIB_SUFFIX}: pkgc.o
${SHLIB_LD} -o $@ pkgc.o ${SHLIB_LD_LIBS}
+tcl9pkgt${SHLIB_SUFFIX}: pkgt.o
+ ${SHLIB_LD} -o $@ pkgt.o ${SHLIB_LD_LIBS}
+
pkga${SHLIB_SUFFIX}: tcl8pkga.o
${SHLIB_LD} -o $@ tcl8pkga.o ${SHLIB_LD_LIBS}
@@ -96,6 +105,9 @@ pkgb${SHLIB_SUFFIX}: tcl8pkgb.o
pkgc${SHLIB_SUFFIX}: tcl8pkgc.o
${SHLIB_LD} -o $@ tcl8pkgc.o ${SHLIB_LD_LIBS}
+pkgt${SHLIB_SUFFIX}: tcl8pkgt.o
+ ${SHLIB_LD} -o $@ tcl8pkgt.o ${SHLIB_LD_LIBS}
+
tcl9pkgd${SHLIB_SUFFIX}: pkgd.o
${SHLIB_LD} -o $@ pkgd.o ${SHLIB_LD_LIBS}
@@ -120,6 +132,9 @@ tcl9pkgb${DLTEST_SUFFIX}: pkgb.o
tcl9pkgc${DLTEST_SUFFIX}: pkgc.o
${DLTEST_LD} -o $@ pkgc.o ${SHLIB_LD_LIBS}
+tcl9pkgt${DLTEST_SUFFIX}: pkgt.o
+ ${DLTEST_LD} -o $@ pkgt.o ${SHLIB_LD_LIBS}
+
pkga${DLTEST_SUFFIX}: tcl8pkga.o
${DLTEST_LD} -o $@ tcl8pkga.o ${SHLIB_LD_LIBS}
@@ -129,6 +144,9 @@ pkgb${DLTEST_SUFFIX}: tcl8pkgb.o
pkgc${DLTEST_SUFFIX}: tcl8pkgc.o
${DLTEST_LD} -o $@ tcl8pkgc.o ${SHLIB_LD_LIBS}
+pkgt${DLTEST_SUFFIX}: tcl8pkgt.o
+ ${DLTEST_LD} -o $@ tcl8pkgt.o ${SHLIB_LD_LIBS}
+
tcl9pkgd${DLTEST_SUFFIX}: pkgd.o
${DLTEST_LD} -o $@ pkgd.o ${SHLIB_LD_LIBS}
diff --git a/unix/dltest/embtest.c b/unix/dltest/embtest.c
index 1111268..ff58cc4 100644
--- a/unix/dltest/embtest.c
+++ b/unix/dltest/embtest.c
@@ -6,6 +6,7 @@ MODULE_SCOPE const TclStubs *tclStubsPtr;
int main(int argc, char **argv) {
const char *version;
int exitcode = 0;
+ (void)argc;
if (tclStubsPtr != NULL) {
printf("ERROR: stub table is already initialized");
@@ -25,6 +26,9 @@ int main(int argc, char **argv) {
}
tclStubsPtr = NULL;
version = Tcl_FindExecutable(argv[0]);
+ if (version != NULL) {
+ printf("Tcl_FindExecutable gives version %s\n", version);
+ }
if (tclStubsPtr == NULL) {
printf("ERROR: Tcl_FindExecutable does not initialize the stub table\n");
exitcode = 1;
diff --git a/unix/dltest/pkga.c b/unix/dltest/pkga.c
index aacb9cd..be0a492 100644
--- a/unix/dltest/pkga.c
+++ b/unix/dltest/pkga.c
@@ -51,7 +51,7 @@ Pkga_EqObjCmd(
str1 = Tcl_GetStringFromObj(objv[1], &len1);
str2 = Tcl_GetStringFromObj(objv[2], &len2);
if (len1 == len2) {
- result = (Tcl_UtfNcmp(str1, str2, len1) == 0);
+ result = (Tcl_UtfNcmp(str1, str2, (size_t)len1) == 0);
} else {
result = 0;
}
diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c
index 750d270..9e834ea 100644
--- a/unix/dltest/pkgb.c
+++ b/unix/dltest/pkgb.c
@@ -13,6 +13,9 @@
#undef STATIC_BUILD
#include "tcl.h"
+#if defined(_WIN32) && defined(_MSC_VER)
+# define snprintf _snprintf
+#endif
/*
*----------------------------------------------------------------------
@@ -48,7 +51,7 @@ Pkgb_SubObjCmd(
if ((Tcl_GetIntFromObj(interp, objv[1], &first) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[2], &second) != TCL_OK)) {
char buf[TCL_INTEGER_SPACE];
- sprintf(buf, "%d", Tcl_GetErrorLine(interp));
+ snprintf(buf, sizeof(buf), "%d", Tcl_GetErrorLine(interp));
Tcl_AppendResult(interp, " in line: ", buf, NULL);
return TCL_ERROR;
}
@@ -105,7 +108,7 @@ Pkgb_DemoObjCmd(
if (Tcl_GetWideIntFromObj(interp, objv[3], &numChars) != TCL_OK) {
return TCL_ERROR;
}
- result = Tcl_UtfNcmp(Tcl_GetString(objv[1]), Tcl_GetString(objv[2]), numChars);
+ result = Tcl_UtfNcmp(Tcl_GetString(objv[1]), Tcl_GetString(objv[2]), (size_t)numChars);
Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
return TCL_OK;
}
diff --git a/unix/dltest/pkgooa.c b/unix/dltest/pkgooa.c
index ec9fbfd..444bb81 100644
--- a/unix/dltest/pkgooa.c
+++ b/unix/dltest/pkgooa.c
@@ -94,6 +94,15 @@ static TclOOStubs stubsCopy = {
#ifdef Tcl_GetObjectClassName
,NULL
#endif
+#ifdef Tcl_MethodIsType2
+ ,NULL
+#endif
+#ifdef Tcl_NewInstanceMethod2
+ ,NULL
+#endif
+#ifdef Tcl_NewMethod2
+ ,NULL
+#endif
};
DLLEXPORT int
diff --git a/unix/dltest/pkgt.c b/unix/dltest/pkgt.c
new file mode 100644
index 0000000..77c2915
--- /dev/null
+++ b/unix/dltest/pkgt.c
@@ -0,0 +1,116 @@
+/*
+ * pkgt.c --
+ *
+ * This file contains a simple Tcl package "pkgt" that is intended for
+ * testing the Tcl dynamic loading facilities.
+ *
+ * Copyright © 1995 Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#undef STATIC_BUILD
+#include "tcl.h"
+
+static int TraceProc2 (
+ void *clientData,
+ Tcl_Interp *interp,
+ size_t level,
+ const char *command,
+ Tcl_Command commandInfo,
+ size_t objc,
+ struct Tcl_Obj *const *objv)
+{
+ (void)clientData;
+ (void)interp;
+ (void)level;
+ (void)command;
+ (void)commandInfo;
+ (void)objc;
+ (void)objv;
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Pkgt_EqObjCmd2 --
+ *
+ * This procedure is invoked to process the "pkgt_eq" Tcl command. It
+ * expects two arguments and returns 1 if they are the same, 0 if they
+ * are different.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+Pkgt_EqObjCmd2(
+ void *dummy, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ size_t objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ Tcl_WideInt result;
+ const char *str1, *str2;
+ size_t len1, len2;
+ (void)dummy;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "string1 string2");
+ return TCL_ERROR;
+ }
+
+ str1 = Tcl_GetStringFromObj(objv[1], &len1);
+ str2 = Tcl_GetStringFromObj(objv[2], &len2);
+ if (len1 == len2) {
+ result = (Tcl_UtfNcmp(str1, str2, len1) == 0);
+ } else {
+ result = 0;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Pkgt_Init --
+ *
+ * This is a package initialization procedure, which is called by Tcl
+ * when this package is to be added to an interpreter.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+DLLEXPORT int
+Pkgt_Init(
+ Tcl_Interp *interp) /* Interpreter in which the package is to be
+ * made available. */
+{
+ int code;
+
+ if (Tcl_InitStubs(interp, "8.7-", 0) == NULL) {
+ return TCL_ERROR;
+ }
+ code = Tcl_PkgProvide(interp, "pkgt", "1.0");
+ if (code != TCL_OK) {
+ return code;
+ }
+ Tcl_CreateObjCommand2(interp, "pkgt_eq", Pkgt_EqObjCmd2, NULL, NULL);
+ Tcl_CreateObjTrace2(interp, 0, 0, TraceProc2, NULL, NULL);
+ return TCL_OK;
+}
diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index dd6c50e..0913698 100644
--- a/unix/tclLoadDl.c
+++ b/unix/tclLoadDl.c
@@ -191,7 +191,7 @@ FindSymbol(
#ifdef __cplusplus
if (proc == NULL) {
char buf[32];
- sprintf(buf, "%d", (int)Tcl_DStringLength(&ds));
+ snprintf(buf, sizeof(buf), "%d", (int)Tcl_DStringLength(&ds));
Tcl_DStringInit(&newName);
TclDStringAppendLiteral(&newName, "__Z");
Tcl_DStringAppend(&newName, buf, TCL_INDEX_NONE);
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 0b4b6e3..af444f5 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));
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 955609e..376e72b 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -490,7 +490,7 @@ TclpInitLibraryPath(
* installed.
*/
- sprintf(installLib, "lib/tcl%s", TCL_VERSION);
+ snprintf(installLib, sizeof(installLib), "lib/tcl%s", TCL_VERSION);
/*
* If TCL_LIBRARY is set, search there.
@@ -901,7 +901,7 @@ TclpSetVariables(
osInfo.dwMajorVersion = 11;
}
Tcl_SetVar2(interp, "tcl_platform", "os", "Windows NT", TCL_GLOBAL_ONLY);
- sprintf(buffer, "%d.%d", osInfo.dwMajorVersion, osInfo.dwMinorVersion);
+ snprintf(buffer, sizeof(buffer), "%d.%d", osInfo.dwMajorVersion, osInfo.dwMinorVersion);
Tcl_SetVar2(interp, "tcl_platform", "osVersion", buffer, TCL_GLOBAL_ONLY);
if (sysInfo.wProcessorArchitecture < NUMPROCESSORS) {
Tcl_SetVar2(interp, "tcl_platform", "machine",
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index 0692df5..19127d2 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.c
@@ -476,7 +476,7 @@ TclpCreateProcess(
|| (!joinThisError && !SetupStdFile(errorFile, TCL_STDERR))
|| (joinThisError &&
((dup2(1,2) == -1) || (fcntl(2, F_SETFD, 0) != 0)))) {
- sprintf(errSpace,
+ snprintf(errSpace, sizeof(errSpace),
"%dforked process couldn't set up input/output", errno);
len = strlen(errSpace);
if (len != (size_t) write(fd, errSpace, len)) {
@@ -491,7 +491,7 @@ TclpCreateProcess(
RestoreSignals();
execvp(newArgv[0], newArgv); /* INTL: Native. */
- sprintf(errSpace, "%dcouldn't execute \"%.150s\"", errno, argv[0]);
+ snprintf(errSpace, sizeof(errSpace), "%dcouldn't execute \"%.150s\"", errno, argv[0]);
len = strlen(errSpace);
if (len != (size_t) write(fd, errSpace, len)) {
Tcl_Panic("TclpCreateProcess: unable to write to errPipeOut");
@@ -783,7 +783,7 @@ TclpCreateCommandChannel(
* natural to use "pipe%d".
*/
- sprintf(channelName, "file%d", channelId);
+ snprintf(channelName, sizeof(channelName), "file%d", channelId);
statePtr->channel = Tcl_CreateChannel(&pipeChannelType, channelName,
statePtr, mode);
return statePtr->channel;
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index c16b081..dec3833 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -1545,7 +1545,7 @@ Tcl_OpenTcpClient(
return NULL;
}
- sprintf(channelName, SOCK_TEMPLATE, PTR2INT(statePtr));
+ snprintf(channelName, sizeof(channelName), SOCK_TEMPLATE, PTR2INT(statePtr));
statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName,
statePtr, TCL_READABLE | TCL_WRITABLE);
@@ -1612,7 +1612,7 @@ TclpMakeTcpClientChannelMode(
statePtr->fds.fd = PTR2INT(sock);
statePtr->flags = 0;
- sprintf(channelName, SOCK_TEMPLATE, PTR2INT(statePtr));
+ snprintf(channelName, sizeof(channelName), SOCK_TEMPLATE, PTR2INT(statePtr));
statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName,
statePtr, mode);
@@ -1838,7 +1838,7 @@ Tcl_OpenTcpServerEx(
memset(statePtr, 0, sizeof(TcpState));
statePtr->acceptProc = acceptProc;
statePtr->acceptProcData = acceptProcData;
- sprintf(channelName, SOCK_TEMPLATE, PTR2INT(statePtr));
+ snprintf(channelName, sizeof(channelName), SOCK_TEMPLATE, PTR2INT(statePtr));
newfds = &statePtr->fds;
} else {
newfds = (TcpFdList *)Tcl_Alloc(sizeof(TcpFdList));
@@ -1930,7 +1930,7 @@ TcpAccept(
newSockState->flags = 0;
newSockState->fds.fd = newsock;
- sprintf(channelName, SOCK_TEMPLATE, PTR2INT(newSockState));
+ snprintf(channelName, sizeof(channelName), SOCK_TEMPLATE, PTR2INT(newSockState));
newSockState->channel = Tcl_CreateChannel(&tcpChannelType, channelName,
newSockState, TCL_READABLE | TCL_WRITABLE);
diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c
index ccb9105..b482464 100644
--- a/unix/tclUnixTest.c
+++ b/unix/tclUnixTest.c
@@ -190,7 +190,7 @@ TestfilehandlerCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index");
return TCL_ERROR;
}
- sprintf(buf, "%d %d", pipePtr->readCount, pipePtr->writeCount);
+ snprintf(buf, sizeof(buf), "%d %d", pipePtr->readCount, pipePtr->writeCount);
Tcl_AppendResult(interp, buf, NULL);
} else if (strcmp(Tcl_GetString(objv[1]), "create") == 0) {
if (objc != 5) {