diff options
| author | Markus Uhlin <markus@nifty-networks.net> | 2026-03-24 21:44:44 +0100 |
|---|---|---|
| committer | Markus Uhlin <markus@nifty-networks.net> | 2026-03-24 21:44:44 +0100 |
| commit | df6b64a9bddb0309d8cc520cf38df5d20426c54e (patch) | |
| tree | 4f686d859d1cf3cb912f2c08a768164b1c2a4aeb | |
| parent | a0e15c53ca175dbf4aaf46b614bc19844f5003da (diff) | |
com_news: handle too long filenames
| -rw-r--r-- | FICS/comproc.c | 7 |
1 files changed, 6 insertions, 1 deletions
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; |
