From 9d3b5040e833831f83d9a03729cd08353b1ac0f5 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Thu, 18 Jul 2024 00:05:57 +0200 Subject: ReadMove: check the return of fgets() --- FICS/gamedb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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", -- cgit v1.2.3