Index: Makefile.in =================================================================== diff -u -r1c256d871fdda3b5f51923b072129b9c589f567e -r37c87756387c17e0f2f43634c0d452a91f91c844 --- Makefile.in (.../Makefile.in) (revision 1c256d871fdda3b5f51923b072129b9c589f567e) +++ Makefile.in (.../Makefile.in) (revision 37c87756387c17e0f2f43634c0d452a91f91c844) @@ -748,7 +748,7 @@ TCL_SRC_DIR_86=/usr/local/src/core-8-6-6-rc TCL_SRC_DIR_87=/usr/local/src/tcl-trunk -genstubs: +genstubs: $(src_generic_dir)/nsf.decls mkdir -p $(src_generic_dir)/stubs8.5 tclsh8.5 $(TCL_SRC_DIR_85)/tools/genStubs.tcl $(src_generic_dir)/stubs8.5 \ $(src_generic_dir)/nsf.decls $(src_generic_dir)/nsfInt.decls Index: generic/nsf.c =================================================================== diff -u -rb916a5a392a9d352ac374912aea282b98f59c0ce -r37c87756387c17e0f2f43634c0d452a91f91c844 --- generic/nsf.c (.../nsf.c) (revision b916a5a392a9d352ac374912aea282b98f59c0ce) +++ generic/nsf.c (.../nsf.c) (revision 37c87756387c17e0f2f43634c0d452a91f91c844) @@ -25098,12 +25098,13 @@ Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj("length", -1)); Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewIntObj(objPtr->length)); Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj("hex", -1)); + if (objPtr->bytes != NULL) { int i; char buffer[24]; for (i = 0; i < 10 && i < objPtr->length; i++) { - sprintf(buffer + i*2, "%.2x", (unsigned)(*((objPtr->bytes)+i) & 0xff)); + snprintf(buffer + i*2, 24, "%.2x", (unsigned)(*((objPtr->bytes)+i) & 0xff)); } if (objPtr->length > 10) { strcat(buffer, "..."); Index: generic/nsf.decls =================================================================== diff -u -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba -r37c87756387c17e0f2f43634c0d452a91f91c844 --- generic/nsf.decls (.../nsf.decls) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) +++ generic/nsf.decls (.../nsf.decls) (revision 37c87756387c17e0f2f43634c0d452a91f91c844) @@ -153,7 +153,7 @@ } declare 27 generic { - int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, const char *typeName, void *valuePtr) + int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, size_t size, const char *typeName, void *valuePtr) } declare 28 generic { Index: generic/nsf.h =================================================================== diff -u -r81788340d06828bb7131be38cc31858cf842612e -r37c87756387c17e0f2f43634c0d452a91f91c844 --- generic/nsf.h (.../nsf.h) (revision 81788340d06828bb7131be38cc31858cf842612e) +++ generic/nsf.h (.../nsf.h) (revision 37c87756387c17e0f2f43634c0d452a91f91c844) @@ -439,8 +439,8 @@ * Nsf Pointer converter interface */ -EXTERN int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, CONST char *typeName, void *valuePtr) - NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3) NSF_nonnull(4); +EXTERN int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, size_t size, CONST char *typeName, void *valuePtr) + NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(4) NSF_nonnull(5); EXTERN int Nsf_PointerDelete(CONST char *key, void *valuePtr, int free) NSF_nonnull(2); Index: generic/nsfPointer.c =================================================================== diff -u -r0de05aaed50fced1cd80a9408560a38fb2454bcf -r37c87756387c17e0f2f43634c0d452a91f91c844 --- generic/nsfPointer.c (.../nsfPointer.c) (revision 0de05aaed50fced1cd80a9408560a38fb2454bcf) +++ generic/nsfPointer.c (.../nsfPointer.c) (revision 37c87756387c17e0f2f43634c0d452a91f91c844) @@ -59,7 +59,7 @@ *---------------------------------------------------------------------- */ int -Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, const char *typeName, void *valuePtr) { +Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, size_t size, const char *typeName, void *valuePtr) { int *counterPtr; nonnull_assert(interp != NULL); @@ -69,15 +69,15 @@ counterPtr = Nsf_PointerTypeLookup(interp, typeName); if (counterPtr != NULL) { - Tcl_DString ds, *dsPtr = &ds; + Tcl_DString ds, *dsPtr = &ds; Tcl_HashEntry *hPtr; - int isNew; + int isNew; Tcl_DStringInit(dsPtr); Tcl_DStringAppend(dsPtr, typeName, -1); Tcl_DStringAppend(dsPtr, ":%d", 3); NsfMutexLock(&pointerMutex); - sprintf(buffer, Tcl_DStringValue(dsPtr), (*counterPtr)++); + snprintf(buffer, size, Tcl_DStringValue(dsPtr), (*counterPtr)++); hPtr = Tcl_CreateHashEntry(pointerHashTablePtr, buffer, &isNew); NsfMutexUnlock(&pointerMutex); Tcl_SetHashValue(hPtr, valuePtr); Index: generic/stubs8.5/nsfDecls.h =================================================================== diff -u -r453ad27418d60f0ab744ae4ac911bcd5e2505140 -r37c87756387c17e0f2f43634c0d452a91f91c844 --- generic/stubs8.5/nsfDecls.h (.../nsfDecls.h) (revision 453ad27418d60f0ab744ae4ac911bcd5e2505140) +++ generic/stubs8.5/nsfDecls.h (.../nsfDecls.h) (revision 37c87756387c17e0f2f43634c0d452a91f91c844) @@ -232,7 +232,8 @@ #define Nsf_PointerAdd_TCL_DECLARED /* 27 */ EXTERN int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, - CONST char *typeName, VOID *valuePtr); + size_t size, CONST char *typeName, + VOID *valuePtr); #endif #ifndef Nsf_PointerDelete_TCL_DECLARED #define Nsf_PointerDelete_TCL_DECLARED @@ -364,7 +365,7 @@ int (*nsfCreate) (Tcl_Interp *in, Nsf_Class *class, Tcl_Obj *name, int objc, Tcl_Obj *CONST objv[]); /* 24 */ int (*nsf_ArgumentParse) (Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Nsf_Object *object, Tcl_Obj *procNameObj, Nsf_Param CONST *paramPtr, int nrParams, int serial, unsigned int processFlags, Nsf_ParseContext *pcPtr); /* 25 */ void (*nsfLog) (Tcl_Interp *interp, int requiredLevel, CONST char *fmt, ...); /* 26 */ - int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, CONST char *typeName, VOID *valuePtr); /* 27 */ + int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, size_t size, CONST char *typeName, VOID *valuePtr); /* 27 */ int (*nsf_PointerDelete) (CONST char *key, VOID *valuePtr, int free); /* 28 */ int (*nsf_PointerTypeRegister) (Tcl_Interp *interp, CONST char*typeName, int *counterPtr); /* 29 */ int (*nsf_ConvertToBoolean) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 30 */ Index: generic/stubs8.6/nsfDecls.h =================================================================== diff -u -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba -r37c87756387c17e0f2f43634c0d452a91f91c844 --- generic/stubs8.6/nsfDecls.h (.../nsfDecls.h) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) +++ generic/stubs8.6/nsfDecls.h (.../nsfDecls.h) (revision 37c87756387c17e0f2f43634c0d452a91f91c844) @@ -152,7 +152,8 @@ const char *fmt, ...); /* 27 */ EXTERN int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, - const char *typeName, void *valuePtr); + size_t size, const char *typeName, + void *valuePtr); /* 28 */ EXTERN int Nsf_PointerDelete(CONST char *key, void *valuePtr, int free); @@ -241,7 +242,7 @@ int (*nsfCreate) (Tcl_Interp *in, Nsf_Class *class, Tcl_Obj *name, int objc, Tcl_Obj *CONST objv[]); /* 24 */ int (*nsf_ArgumentParse) (Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Nsf_Object *object, Tcl_Obj *procNameObj, Nsf_Param CONST *paramPtr, int nrParams, int serial, unsigned int processFlags, Nsf_ParseContext *pcPtr); /* 25 */ void (*nsfLog) (Tcl_Interp *interp, int requiredLevel, const char *fmt, ...); /* 26 */ - int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, const char *typeName, void *valuePtr); /* 27 */ + int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, size_t size, const char *typeName, void *valuePtr); /* 27 */ int (*nsf_PointerDelete) (CONST char *key, void *valuePtr, int free); /* 28 */ int (*nsf_PointerTypeRegister) (Tcl_Interp *interp, const char*typeName, int *counterPtr); /* 29 */ int (*nsf_ConvertToBoolean) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 30 */ Index: generic/stubs8.7/nsfDecls.h =================================================================== diff -u -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba -r37c87756387c17e0f2f43634c0d452a91f91c844 --- generic/stubs8.7/nsfDecls.h (.../nsfDecls.h) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) +++ generic/stubs8.7/nsfDecls.h (.../nsfDecls.h) (revision 37c87756387c17e0f2f43634c0d452a91f91c844) @@ -152,7 +152,8 @@ const char *fmt, ...); /* 27 */ EXTERN int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, - const char *typeName, void *valuePtr); + size_t size, const char *typeName, + void *valuePtr); /* 28 */ EXTERN int Nsf_PointerDelete(CONST char *key, void *valuePtr, int free); @@ -241,7 +242,7 @@ int (*nsfCreate) (Tcl_Interp *in, Nsf_Class *class, Tcl_Obj *name, int objc, Tcl_Obj *CONST objv[]); /* 24 */ int (*nsf_ArgumentParse) (Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Nsf_Object *object, Tcl_Obj *procNameObj, Nsf_Param CONST *paramPtr, int nrParams, int serial, unsigned int processFlags, Nsf_ParseContext *pcPtr); /* 25 */ void (*nsfLog) (Tcl_Interp *interp, int requiredLevel, const char *fmt, ...); /* 26 */ - int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, const char *typeName, void *valuePtr); /* 27 */ + int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, size_t size, const char *typeName, void *valuePtr); /* 27 */ int (*nsf_PointerDelete) (CONST char *key, void *valuePtr, int free); /* 28 */ int (*nsf_PointerTypeRegister) (Tcl_Interp *interp, const char*typeName, int *counterPtr); /* 29 */ int (*nsf_ConvertToBoolean) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 30 */ Index: library/mongodb/nsfmongo.c =================================================================== diff -u -r6af35a888e33da976e283271bb68060f34d91a9a -r37c87756387c17e0f2f43634c0d452a91f91c844 --- library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision 6af35a888e33da976e283271bb68060f34d91a9a) +++ library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision 37c87756387c17e0f2f43634c0d452a91f91c844) @@ -668,7 +668,7 @@ * Make an entry in the symbol table and return entry name it as * result. */ - if (Nsf_PointerAdd(interp, channelName, "mongoc_client_t", clientPtr) != TCL_OK) { + if (Nsf_PointerAdd(interp, channelName, 80u, "mongoc_client_t", clientPtr) != TCL_OK) { mongoc_client_destroy(clientPtr); return TCL_ERROR; } @@ -761,7 +761,7 @@ if (collectionPtr != NULL) { char buffer[80]; - if (Nsf_PointerAdd(interp, buffer, "mongoc_collection_t", collectionPtr) == TCL_OK) { + if (Nsf_PointerAdd(interp, buffer, 80u, "mongoc_collection_t", collectionPtr) == TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, -1)); result = TCL_OK; } else { @@ -1191,7 +1191,7 @@ if (cursor != NULL) { char buffer[80]; - if (Nsf_PointerAdd(interp, buffer, "mongoc_cursor_t", cursor) == TCL_OK) { + if (Nsf_PointerAdd(interp, buffer, 80u, "mongoc_cursor_t", cursor) == TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, -1)); } else { mongoc_cursor_destroy( cursor ); @@ -1251,7 +1251,7 @@ if (cursor != NULL) { char buffer[80]; - if (Nsf_PointerAdd(interp, buffer, "mongoc_cursor_t", cursor) == TCL_OK) { + if (Nsf_PointerAdd(interp, buffer, 80u, "mongoc_cursor_t", cursor) == TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, -1)); } else { mongoc_cursor_destroy( cursor ); @@ -1343,7 +1343,7 @@ result = NsfPrintError(interp, "mongo::gridfs::open: error: %s", bsonError.message); } - if (Nsf_PointerAdd(interp, buffer, "mongoc_gridfs_t", gfsPtr) == TCL_OK) { + if (Nsf_PointerAdd(interp, buffer, 80u, "mongoc_gridfs_t", gfsPtr) == TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, -1)); } else { mongoc_gridfs_destroy(gfsPtr); @@ -1552,7 +1552,7 @@ if (gridFilePtr != NULL) { char buffer[80]; - if (Nsf_PointerAdd(interp, buffer, "mongoc_gridfs_file_t", gridFilePtr) == TCL_OK) { + if (Nsf_PointerAdd(interp, buffer, 80u, "mongoc_gridfs_file_t", gridFilePtr) == TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, -1)); } else { mongoc_gridfs_file_destroy(gridFilePtr);