aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--FICS/eco.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/FICS/eco.c b/FICS/eco.c
index 4934ae9..7f83587 100644
--- a/FICS/eco.c
+++ b/FICS/eco.c
@@ -167,7 +167,11 @@ ECO_init(void)
if (fgets(ptmp, sizeof tmp, fp) == NULL ||
feof(fp))
break;
- sscanf(ptmp, SCAN_ECO, ECO);
+ else if (sscanf(ptmp, SCAN_ECO, ECO) != 1) {
+ warnx("%s: scan eco error (%s:%d)", __func__,
+ filename, i);
+ break;
+ }
if ((ECO_book[i] = malloc(sizeof(ECO_entry))) == NULL)
err(1, "Cound not alloc mem for ECO entry %d", i);
@@ -233,7 +237,11 @@ NIC_init(void)
if (fgets(ptmp, sizeof tmp, fp) == NULL ||
feof(fp))
break;
- sscanf(ptmp, SCAN_NIC, NIC);
+ else if (sscanf(ptmp, SCAN_NIC, NIC) != 1) {
+ warnx("%s: scan nic error (%s:%d)", __func__,
+ filename, i);
+ break;
+ }
if ((NIC_book[i] = malloc(sizeof(NIC_entry))) == NULL)
err(1, "Cound not alloc mem for NIC entry %d", i);
@@ -292,7 +300,11 @@ LONG_init(void)
if (fgets(ptmp, sizeof tmp, fp) == NULL ||
feof(fp))
break;
- sscanf(ptmp, SCAN_LONG, LONG);
+ else if (sscanf(ptmp, SCAN_LONG, LONG) != 1) {
+ warnx("%s: scan long error (%s:%d)", __func__,
+ filename, i);
+ break;
+ }
if ((LONG_book[i] = malloc(sizeof(LONG_entry))) == NULL)
err(1, "Cound not alloc mem for LONG entry %d", i);