From b3b3277ceb473b59748a7353d26ec867a7868df7 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sat, 23 Nov 2024 17:19:41 +0100 Subject: pjournal: fscanf: added width spec (found by PVS-Studio) --- FICS/gamedb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'FICS') diff --git a/FICS/gamedb.c b/FICS/gamedb.c index 61d66db..0d65328 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -2000,8 +2000,16 @@ pjournal(int p, int p1, char *fname) pprintf(p, " White Rating Black Rating " "Type ECO End Result\n"); + _Static_assert(ARRAY_SIZE(WhiteName) > 19, "'WhiteName' too small"); + _Static_assert(ARRAY_SIZE(BlackName) > 19, "'BlackName' too small"); + + _Static_assert(ARRAY_SIZE(type) > 99, "'type' too small"); + _Static_assert(ARRAY_SIZE(eco) > 99, "'eco' too small"); + _Static_assert(ARRAY_SIZE(ending) > 99, "'ending' too small"); + _Static_assert(ARRAY_SIZE(result) > 99, "'result' too small"); + while (!feof(fp)) { - if (fscanf(fp, "%c %s %d %s %d %s %d %d %s %s %s\n", + if (fscanf(fp, "%c %19s %d %19s %d %99s %d %d %99s %99s %99s\n", &count, WhiteName, &WhiteRating, BlackName, &BlackRating, -- cgit v1.2.3