diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-11-20 22:53:27 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-11-20 22:53:27 +0100 |
commit | 3b3652b814a23120d479c745d61086a67117eedd (patch) | |
tree | 68e52e300c86393e3b106428f66fccd254f7bb20 /FICS | |
parent | 3749e5361f0f805b153ab9768e737f2cec150db3 (diff) |
Fixed ignored retvals
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/eco.c | 41 |
1 files changed, 30 insertions, 11 deletions
@@ -148,10 +148,16 @@ ECO_init(void) feof(fp)) break; - /* XXX */ - sscanf(ptmp, SCAN_FP_AND_ONMOVE, FENpos, onMove); - (void) strlcat(FENpos, " ", sizeof FENpos); - (void) strlcat(FENpos, onMove, sizeof FENpos); + if (sscanf(ptmp, SCAN_FP_AND_ONMOVE, FENpos, onMove) != 2) { + warnx("%s: sscanf() error (%s:%d)", __func__, + filename, i); + break; + } else if (strlcat(FENpos, " ", sizeof FENpos) >= sizeof FENpos || + strlcat(FENpos, onMove, sizeof FENpos) >= sizeof FENpos) { + warnx("%s: strlcat() error (%s:%d)", __func__, + filename, i); + break; + } (void) strlcpy(ptmp, "", sizeof tmp); if (fgets(ptmp, sizeof tmp, fp) == NULL || @@ -208,9 +214,16 @@ NIC_init(void) feof(fp)) break; - sscanf(ptmp, SCAN_FP_AND_ONMOVE, FENpos, onMove); - (void) strlcat(FENpos, " ", sizeof FENpos); - (void) strlcat(FENpos, onMove, sizeof FENpos); + if (sscanf(ptmp, SCAN_FP_AND_ONMOVE, FENpos, onMove) != 2) { + warnx("%s: sscanf() error (%s:%d)", __func__, + filename, i); + break; + } else if (strlcat(FENpos, " ", sizeof FENpos) >= sizeof FENpos || + strlcat(FENpos, onMove, sizeof FENpos) >= sizeof FENpos) { + warnx("%s: strlcat() error (%s:%d)", __func__, + filename, i); + break; + } (void) strlcpy(ptmp, "", sizeof tmp); if (fgets(ptmp, sizeof tmp, fp) == NULL || @@ -260,10 +273,16 @@ LONG_init(void) feof(fp)) break; - /* XXX */ - sscanf(ptmp, SCAN_FP_AND_ONMOVE, FENpos, onMove); - (void) strlcat(FENpos, " ", sizeof FENpos); - (void) strlcat(FENpos, onMove, sizeof FENpos); + if (sscanf(ptmp, SCAN_FP_AND_ONMOVE, FENpos, onMove) != 2) { + warnx("%s: sscanf() error (%s:%d)", __func__, + filename, i); + break; + } else if (strlcat(FENpos, " ", sizeof FENpos) >= sizeof FENpos || + strlcat(FENpos, onMove, sizeof FENpos) >= sizeof FENpos) { + warnx("%s: strlcat() error (%s:%d)", __func__, + filename, i); + break; + } (void) strlcpy(ptmp, "", sizeof tmp); if (fgets(ptmp, sizeof tmp, fp) == NULL || |