From fc34453ea323fdd8e38e5ac5ed924777ee212101 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sun, 6 Jun 2021 00:01:35 -0700
Subject: [PATCH] BadFilename text.dat string is now a format string

(prints the bad filename)
- also, checkfname() is going to do the file.can (trashcan) checking, so no need here
---
 src/sbbs3/email.cpp    | 2 +-
 src/sbbs3/upload.cpp   | 5 ++---
 src/sbbs3/writemsg.cpp | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/sbbs3/email.cpp b/src/sbbs3/email.cpp
index c2486532cd..0f3166f2df 100644
--- a/src/sbbs3/email.cpp
+++ b/src/sbbs3/email.cpp
@@ -130,7 +130,7 @@ bool sbbs_t::email(int usernumber, const char *top, const char *subj, long mode,
 
 	if(mode&WM_FILE) {
 		if(!checkfname(title)) {
-			bputs(text[BadFilename]);
+			bprintf(text[BadFilename], title);
 			(void)remove(msgpath);
 			return(false);
 		}
diff --git a/src/sbbs3/upload.cpp b/src/sbbs3/upload.cpp
index 0734327922..3ff7132b26 100644
--- a/src/sbbs3/upload.cpp
+++ b/src/sbbs3/upload.cpp
@@ -276,10 +276,9 @@ bool sbbs_t::upload(uint dirnum)
 
 	f.dir=curdirnum=dirnum;
 	bputs(text[Filename]);
-	if(getstr(fname, sizeof(fname) - 1, 0) < 1 || strchr(fname,'?') || strchr(fname,'*')
-		|| !checkfname(fname) || (trashcan(fname,"file") && !dir_op(dirnum))) {
+	if(getstr(fname, sizeof(fname) - 1, 0) < 1 || strchr(fname,'?') || strchr(fname,'*') || !checkfname(fname)) {
 		if(fname[0])
-			bputs(text[BadFilename]);
+			bprintf(text[BadFilename], fname);
 		return(false); 
 	}
 	if(dirnum==cfg.sysop_dir)
diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp
index 7865c23e23..f4aba92115 100644
--- a/src/sbbs3/writemsg.cpp
+++ b/src/sbbs3/writemsg.cpp
@@ -486,7 +486,7 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
 		}
 		if((mode&WM_FILE) && !checkfname(subj)) {
 			free(buf);
-			bputs(text[BadFilename]);
+			bprintf(text[BadFilename], subj);
 			return(false);
 		}
 		if(!(mode&(WM_EMAIL|WM_NETMAIL)) && cfg.sub[subnum]->misc&SUB_QNET
-- 
GitLab