aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-10 17:04:39 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-10 17:04:39 +0100
commit9bee883aee78de5c8fdbd7add5622237a740e75a (patch)
treeb9af9b59538c002976475b7d099e5739fdac209b /FICS
parent449127c2e622a30d988bc8f0cc104f9445b8fae4 (diff)
Check for truncation
Diffstat (limited to 'FICS')
-rw-r--r--FICS/talkproc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/FICS/talkproc.c b/FICS/talkproc.c
index 68f8cb5..ec1a7b8 100644
--- a/FICS/talkproc.c
+++ b/FICS/talkproc.c
@@ -737,6 +737,7 @@ com_mailmess(int p, param_list param)
char fname[MAX_FILENAME_SIZE];
char mdir[MAX_FILENAME_SIZE];
char subj[120];
+ int ret, too_long;
if (!parray[p].registered) {
pprintf(p, "Only registered people can use the mailmess "
@@ -751,9 +752,13 @@ com_mailmess(int p, param_list param)
if (search_directory(mdir, filename, buffer, 1000)) {
snprintf(subj, sizeof subj, "Your FICS messages from server %s",
fics_hostname);
- snprintf(fname, sizeof fname, "%s/%s", mdir, filename);
- mail_file_to_user(p, subj, fname);
- pprintf(p, "Messages sent to %s\n", parray[p].emailAddress);
+ ret = snprintf(fname, sizeof fname, "%s/%s", mdir, filename);
+ too_long = (ret < 0 || (size_t)ret >= sizeof fname);
+ if (!too_long) {
+ mail_file_to_user(p, subj, fname);
+ pprintf(p, "Messages sent to %s\n",
+ parray[p].emailAddress);
+ }
} else {
pprintf(p, "You have no messages.\n");
}