aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/gamedb.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-11-23 10:50:28 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-11-23 10:50:28 +0100
commit67c553e6ea2f436db45aa6eb07019723a4bc04e9 (patch)
tree70aec3f19e6c911263ab906362e8034bdef93d25 /FICS/gamedb.c
parent2d310632eb4d2dd00bd72914660f1d16d72e8191 (diff)
ReadMove: sscanf: added width spec (found by PVS-Studio)
Diffstat (limited to 'FICS/gamedb.c')
-rw-r--r--FICS/gamedb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c
index 2e65af0..598c2c2 100644
--- a/FICS/gamedb.c
+++ b/FICS/gamedb.c
@@ -904,7 +904,10 @@ ReadMove(FILE *fp, move_t *m)
if (fgets(line, sizeof line, fp) == NULL)
return -1;
- if (sscanf(line, "%d %d %d %d %d %d %d %d %d \"%[^\"]\" \"%[^\"]\" "
+ _Static_assert(ARRAY_SIZE(m->moveString) > 7, "'moveString' too small");
+ _Static_assert(ARRAY_SIZE(m->algString) > 7, "'algString' too small");
+
+ if (sscanf(line, "%d %d %d %d %d %d %d %d %d \"%7[^\"]\" \"%7[^\"]\" "
"%u %u\n",
&m->color,
&m->fromFile, &m->fromRank,