aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-07-18 00:05:57 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-07-18 00:05:57 +0200
commit9d3b5040e833831f83d9a03729cd08353b1ac0f5 (patch)
tree518aadb14ff486368e89b2c155441be52e6efc1e
parentb3bf978ba72adcf4879356a7b1634a1dd8f0af3f (diff)
ReadMove: check the return of fgets()
-rw-r--r--FICS/gamedb.c3
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",