From: Matthew Fernandez Date: Thu, 8 Sep 2022 00:27:49 +0000 (-0700) Subject: tclpkg GdPtrTypeUpdate: remove a use of bare 'sprintf' X-Git-Tag: 6.0.2~7^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b9ce8b4b16064ca51b01368e7ae6596701d17ab;p=graphviz tclpkg GdPtrTypeUpdate: remove a use of bare 'sprintf' Gitlab: #1950 --- diff --git a/tclpkg/gdtclft/gdtclft.c b/tclpkg/gdtclft/gdtclft.c index 1e8f01412..e06c1f1ce 100644 --- a/tclpkg/gdtclft/gdtclft.c +++ b/tclpkg/gdtclft/gdtclft.c @@ -1404,8 +1404,9 @@ tclGdWriteBufCmd(Tcl_Interp * interp, int argc, Tcl_Obj * CONST objv[]) static void GdPtrTypeUpdate(struct Tcl_Obj *O) { - O->bytes = Tcl_Alloc(strlen(GdPtrType.name) + (sizeof(void *) + 1) * 2 + 1); - O->length = sprintf(O->bytes, "%s%p", GdPtrType.name, IMGPTR(O)); + size_t len = strlen(GdPtrType.name) + (sizeof(void *) + 1) * 2 + 1; + O->bytes = Tcl_Alloc(len); + O->length = snprintf(O->bytes, len, "%s%p", GdPtrType.name, IMGPTR(O)); } static int