aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/eco.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-11-20 23:02:07 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-11-20 23:02:07 +0100
commite58006974790a984ce56a951d48d27978ad14791 (patch)
tree8e15e58c3f88809f43644750ae4a8e662949bb8e /FICS/eco.c
parent3b3652b814a23120d479c745d61086a67117eedd (diff)
Added width spec, found by PVS-Studio
Diffstat (limited to 'FICS/eco.c')
-rw-r--r--FICS/eco.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/FICS/eco.c b/FICS/eco.c
index 818003c..4934ae9 100644
--- a/FICS/eco.c
+++ b/FICS/eco.c
@@ -29,6 +29,10 @@
#define SCAN_FP_AND_ONMOVE "%72[\x21-z] %1s"
+#define SCAN_ECO "%3[0-z]"
+#define SCAN_NIC "%5[.-z]"
+#define SCAN_LONG "%255[^*\n]"
+
PRIVATE char *book_dir = DEFAULT_BOOK;
PRIVATE ECO_entry *ECO_book[1096];
@@ -163,7 +167,7 @@ ECO_init(void)
if (fgets(ptmp, sizeof tmp, fp) == NULL ||
feof(fp))
break;
- sscanf(ptmp, "%[0-z]", ECO);
+ sscanf(ptmp, SCAN_ECO, ECO);
if ((ECO_book[i] = malloc(sizeof(ECO_entry))) == NULL)
err(1, "Cound not alloc mem for ECO entry %d", i);
@@ -229,7 +233,7 @@ NIC_init(void)
if (fgets(ptmp, sizeof tmp, fp) == NULL ||
feof(fp))
break;
- sscanf(ptmp, "%[.-z]", NIC);
+ sscanf(ptmp, SCAN_NIC, NIC);
if ((NIC_book[i] = malloc(sizeof(NIC_entry))) == NULL)
err(1, "Cound not alloc mem for NIC entry %d", i);
@@ -288,7 +292,7 @@ LONG_init(void)
if (fgets(ptmp, sizeof tmp, fp) == NULL ||
feof(fp))
break;
- sscanf(ptmp, "%[^*\n]", LONG);
+ sscanf(ptmp, SCAN_LONG, LONG);
if ((LONG_book[i] = malloc(sizeof(LONG_entry))) == NULL)
err(1, "Cound not alloc mem for LONG entry %d", i);