aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-11-23 17:19:41 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-11-23 17:19:41 +0100
commitb3b3277ceb473b59748a7353d26ec867a7868df7 (patch)
tree856a5bd2b07f3136d3d17ef7c15f49b6ddcbe5b4
parent1980c37269db5bc5c89e8c6dc038aa960db8947e (diff)
pjournal: fscanf: added width spec (found by PVS-Studio)
-rw-r--r--FICS/gamedb.c10
1 files changed, 9 insertions, 1 deletions
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,