From d52aacd2b245a61f5e3c361599442f70f0abce23 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 3 Jan 2024 23:49:59 +0100 Subject: Null check fgets() --- FICS/comproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FICS/comproc.c b/FICS/comproc.c index 399ccc8..220bc3d 100644 --- a/FICS/comproc.c +++ b/FICS/comproc.c @@ -113,9 +113,9 @@ rscan_news2(FILE *fp, int p, int num) if (num == 0) return; - fgets(junk, MAX_LINE_SIZE, fp); + ; - if (feof(fp)) + if (fgets(junk, sizeof junk, fp) == NULL || feof(fp)) return; sscanf(junk, "%ld %s", &lval, count); -- cgit v1.2.3