From 80fe62606d0e1102c6b99a1e5cef5514be9af7c9 Mon Sep 17 00:00:00 2001 From: Allan CORNET Date: Mon, 4 Nov 2024 21:33:44 +0100 Subject: [PATCH] Fix code scanning alert no. 2328: Potentially overrunning write (#1280) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- modules/f2c/src/c/libf2c/endfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/f2c/src/c/libf2c/endfile.c b/modules/f2c/src/c/libf2c/endfile.c index 2de2036bf4..b5f9ddca73 100644 --- a/modules/f2c/src/c/libf2c/endfile.c +++ b/modules/f2c/src/c/libf2c/endfile.c @@ -49,7 +49,7 @@ alist* a; b = &f__units[a->aunit]; if (b->ufd == NULL) { char nbuf[10]; - sprintf(nbuf, "fort.%ld", (long)a->aunit); + snprintf(nbuf, sizeof(nbuf), "fort.%ld", (long)a->aunit); if (tf = FOPEN(nbuf, f__w_mode[0])) { fclose(tf); }