diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-01-03 03:33:54 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-01-03 03:33:54 +0100 |
commit | 95b9d5d4fabd826a4ec073f8ebf97bd56c3ac247 (patch) | |
tree | 246f95fcaf723ee9442e3b071b929ca0eb27df07 /FICS | |
parent | 0b31e8c8cd3311c23ab38ff5280f42d28b8a9297 (diff) |
Check fgets() return value and use sizeof
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/makerank.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/FICS/makerank.c b/FICS/makerank.c index b1aa8de..299e72e 100644 --- a/FICS/makerank.c +++ b/FICS/makerank.c @@ -36,12 +36,9 @@ GetPlayerInfo(char *fileName, ENTRY *e) e->r[i].rating = 0; } - if ((fp = fopen(fileName, "r")) == NULL) - return 0; - - fgets(line, 99, fp); - - if (feof(fp)) + if ((fp = fopen(fileName, "r")) == NULL || + fgets(line, sizeof line - 1, fp) == NULL || + feof(fp)) return 0; if (!strcmp(line, "v 1\n")) { |