diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-07-17 23:52:02 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-07-17 23:52:02 +0200 |
commit | e982b5749d7eb9b75e939eff0e41a0598848726e (patch) | |
tree | 2a28a63036f49a9545505db68dd6913202975c15 | |
parent | d71f5d9bbdf2cc359ecfd23a8f559c0f3e212d05 (diff) |
ReadGameAttrs: return value checking
-rw-r--r-- | FICS/gamedb.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c index 064a18a..394745c 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -1271,10 +1271,15 @@ ReadGameAttrs(FILE *fp, char *fname, int g) int len; int version = 0; - fgets(line, sizeof line, fp); + if (fgets(line, sizeof line, fp) == NULL) { + warnx("%s: fgets error", __func__); + return -1; + } - if (line[0] == 'v') - sscanf(line, "%*c %d", &version); + if (line[0] == 'v') { + if (sscanf(line, "%*c %d", &version) != 1) + warn("%s: failed to get version", __func__); + } if (version > 0) ReadV1GameFmt(&garray[g], fp, fname, version); |