From df6b64a9bddb0309d8cc520cf38df5d20426c54e Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Tue, 24 Mar 2026 21:44:44 +0100 Subject: com_news: handle too long filenames --- FICS/comproc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'FICS/comproc.c') diff --git a/FICS/comproc.c b/FICS/comproc.c index 41b57b3..3323552 100644 --- a/FICS/comproc.c +++ b/FICS/comproc.c @@ -168,11 +168,16 @@ com_news(int p, param_list param) char *junkp = NULL; const char *v_scan_fmt = "%" SCNd64 " " "%9s"; int found = 0; + int ret; int64_t lval = 0; time_t crtime = 0; - snprintf(filename, sizeof filename, "%s/newnews.index", news_dir); + ret = snprintf(filename, sizeof filename, "%s/newnews.index", news_dir); + if (is_too_long(ret, sizeof filename)) { + warnx("%s: fatal: too long filename", __func__); + return COM_OK; + } if ((fp = fopen(filename, "r")) == NULL) { (void) fprintf(stderr, "Can\'t find news index.\n"); return COM_OK; -- cgit v1.2.3