aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/gamedb.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-08-03 22:41:34 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-08-03 22:41:34 +0200
commit93a68545fc69f41ba91b921de2179a4abb6fe351 (patch)
tree84b10ac08a0c2d502c8cc6f6dc9bbcc33e6bbf73 /FICS/gamedb.c
parentc466574626e199f33e82ccb0e1e4f0196ea77142 (diff)
Check the return of fscanf()
Diffstat (limited to 'FICS/gamedb.c')
-rw-r--r--FICS/gamedb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c
index 99600f8..fe55052 100644
--- a/FICS/gamedb.c
+++ b/FICS/gamedb.c
@@ -1262,7 +1262,11 @@ ReadV1GameFmt(game *g, FILE *fp, const char *file, int version)
} else
g->timeOfStart = lval;
- fscanf(fp, "%d %d", &g->wTime, &g->bTime);
+ if (fscanf(fp, "%d %d", &g->wTime, &g->bTime) != 2) {
+ warnx("%s: %s: failed to get 'wTime' and 'bTime'", __func__,
+ file);
+ return -1;
+ }
if (version > 1)
fscanf(fp, "%d %d", &g->result, &g->winner);