aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-12-02 14:37:25 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-12-02 14:37:25 +0100
commit551f882ff20ac6f902e38e6591fe57484a1da2ef (patch)
tree140af3b6506e768fe57e66d0e9af7ddab67e29b9 /FICS
parent56bf28d72a3cda58fbce373a975dc6668e187f86 (diff)
player_read: fixed ignored fgets() retvals
Diffstat (limited to 'FICS')
-rw-r--r--FICS/playerdb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index e1da179..a82f3b9 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -964,7 +964,11 @@ player_read(int p, char *name)
parray[p].registered = 1; // Lets load the file
- fgets(line, sizeof line, fp); // Ok, so which version file?
+ if (fgets(line, sizeof line, fp) == NULL) { // Ok, so which version
+ warnx("%s: fgets() error", __func__); // file?
+ fclose(fp);
+ return -1;
+ }
if (line[0] == 'v')
sscanf(line, "%*c %d", &version);
@@ -996,7 +1000,9 @@ player_read(int p, char *name)
value = eatwhite(value);
stolower(attr);
got_attr_value_player(p, attr, value, fp, fname);
- fgets(line, sizeof line, fp);
+
+ if (fgets(line, sizeof line, fp) == NULL)
+ break;
} while (!feof(fp));
}