From fed93c200d6e24b36a2fbe5033844f2df5170d6d Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:44:21 +0100 Subject: [PATCH] gcr/gcrShwFlgs.c: Likely overrunning write Fix code scanning alert no. 2: Likely overrunning write (#5) * Fix code scanning alert no. 2: Likely overrunning write Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Update gcrShwFlgs.c * AI added snprintf(), DLM increased buffer for enough space for rounded/aligned 64bit %p --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- gcr/gcrShwFlgs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcr/gcrShwFlgs.c b/gcr/gcrShwFlgs.c index 084a2a76..1c8b1e18 100644 --- a/gcr/gcrShwFlgs.c +++ b/gcr/gcrShwFlgs.c @@ -203,14 +203,14 @@ void gcrDumpChannel(ch) GCRChannel * ch; { - char name[20]; + char name[32]; int track, col, netCount = 0, gcrNetName(); short res; GCRNet * net, * netNames[500]; FILE * fp, * fopen(); netNames[0]=(GCRNet *) 0; - (void) sprintf(name, "channel.%p", ch); + (void) snprintf(name, sizeof(name), "channel.%p", ch); if((fp = fopen(name, "w")) == NULL) { TxError("Can't open file %s to dump channel.\n", name);