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>
This commit is contained in:
Darryl Miles 2024-09-30 01:44:21 +01:00 committed by Tim Edwards
parent 881115a856
commit fed93c200d
1 changed files with 2 additions and 2 deletions

View File

@ -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);