aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-11-23 17:05:42 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-11-23 17:05:42 +0100
commit1980c37269db5bc5c89e8c6dc038aa960db8947e (patch)
tree49f6723dc840d24c73fde991a0fb12080a74102b /FICS
parent83c199b782cc8a80ff72db5d3dbe5fa5aaa20432 (diff)
addjournalitem: fscanf: added width spec (found by PVS-Studio)
Diffstat (limited to 'FICS')
-rw-r--r--FICS/gamedb.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c
index aba3080..61d66db 100644
--- a/FICS/gamedb.c
+++ b/FICS/gamedb.c
@@ -1903,8 +1903,19 @@ addjournalitem(int p, char count2, char *WhiteName2, int WhiteRating2,
rename(fname2, fname);
return;
} else {
+ _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,