aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-01-03 04:18:33 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-01-03 04:18:33 +0100
commit75e718a3df2be1dee37ec18266e61ede8d2063c3 (patch)
tree7988799078f3caba0d7018ff930faee8e942fbff /FICS
parent3b30aa0c238cd105ca9a8c3b381e7b6589c0afce (diff)
Check for truncation
Diffstat (limited to 'FICS')
-rw-r--r--FICS/makerank.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/FICS/makerank.c b/FICS/makerank.c
index d8be7f6..3e33ac9 100644
--- a/FICS/makerank.c
+++ b/FICS/makerank.c
@@ -187,9 +187,11 @@ SetComputers(int n)
char line[100];
int i = 0;
- snprintf(line, sizeof line, "sort -f %s", COMPUTER_FILE);
-
- if ((fpComp = popen(line, "r")) == NULL)
+ if (snprintf(line, sizeof line, "sort -f %s", COMPUTER_FILE) >=
+ sizeof line) {
+ warnx("%s: snprintf truncated", __func__);
+ return 0;
+ } else if ((fpComp = popen(line, "r")) == NULL)
return 0;
while (i < n) {