diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-07-18 00:05:57 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-07-18 00:05:57 +0200 |
commit | 9d3b5040e833831f83d9a03729cd08353b1ac0f5 (patch) | |
tree | 518aadb14ff486368e89b2c155441be52e6efc1e | |
parent | b3bf978ba72adcf4879356a7b1634a1dd8f0af3f (diff) |
ReadMove: check the return of fgets()
-rw-r--r-- | FICS/gamedb.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c index 394745c..2c4511b 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -899,7 +899,8 @@ ReadMove(FILE *fp, move_t *m) { char line[MAX_GLINE_SIZE] = { '\0' }; - fgets(line, sizeof line, fp); + if (fgets(line, sizeof line, fp) == NULL) + return -1; if (sscanf(line, "%d %d %d %d %d %d %d %d %d \"%[^\"]\" \"%[^\"]\" " "%u %u\n", |