diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-08-03 22:41:34 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-08-03 22:41:34 +0200 |
commit | 93a68545fc69f41ba91b921de2179a4abb6fe351 (patch) | |
tree | 84b10ac08a0c2d502c8cc6f6dc9bbcc33e6bbf73 /FICS/gamedb.c | |
parent | c466574626e199f33e82ccb0e1e4f0196ea77142 (diff) |
Check the return of fscanf()
Diffstat (limited to 'FICS/gamedb.c')
-rw-r--r-- | FICS/gamedb.c | 6 |
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); |