From: Matthew Fernandez Date: Sat, 14 Jan 2023 23:20:22 +0000 (-0800) Subject: smyrna smyrnaPath: replace 'sprintf' calls with 'snprintf' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=affa3a9e37eb19e180693ce9bb05bca1bd3ca50a;p=graphviz smyrna smyrnaPath: replace 'sprintf' calls with 'snprintf' Gitlab: #1950 --- diff --git a/cmd/smyrna/main.c b/cmd/smyrna/main.c index 3edf9ab1d..af6216198 100644 --- a/cmd/smyrna/main.c +++ b/cmd/smyrna/main.c @@ -79,9 +79,9 @@ char *smyrnaPath(char *suffix) if (baselen == 0) { baselen = strlen(smyrnaDir) + 2; } - size_t slen = strlen(suffix); - char *buf = gv_calloc(baselen + slen, sizeof(char)); - sprintf(buf, "%s%s%s", smyrnaDir, pathSep, suffix); + size_t len = baselen + strlen(suffix); + char *buf = gv_calloc(len, sizeof(char)); + snprintf(buf, len, "%s%s%s", smyrnaDir, pathSep, suffix); return buf; }