summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-11-09 15:22:12 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-11-09 15:22:12 +0800
commit9f9334d2290b611d080595d445fd539ec0ff78f6 (patch)
tree14258fed6c935a8531b375b0b76a8e0b8ebc4e6f
parent3c2ee29bb8173fb02abf06d6e198bcd55ebee822 (diff)
downloadpttbbs-9f9334d2290b611d080595d445fd539ec0ff78f6.tar
pttbbs-9f9334d2290b611d080595d445fd539ec0ff78f6.tar.gz
pttbbs-9f9334d2290b611d080595d445fd539ec0ff78f6.tar.bz2
pttbbs-9f9334d2290b611d080595d445fd539ec0ff78f6.tar.lz
pttbbs-9f9334d2290b611d080595d445fd539ec0ff78f6.tar.xz
pttbbs-9f9334d2290b611d080595d445fd539ec0ff78f6.tar.zst
pttbbs-9f9334d2290b611d080595d445fd539ec0ff78f6.zip
alert when Forwarding non-exist files
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5232 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/mail.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c
index 7338f9bd..69680316 100644
--- a/pttbbs/mbbsd/mail.c
+++ b/pttbbs/mbbsd/mail.c
@@ -2286,6 +2286,8 @@ doforward(const char *direct, const fileheader_t * fh, int mode)
}
} while (0);
+ // PATHLEN will be used as command line, so we need it longer.
+ assert(PATHLEN >= 256);
if (mode == 'Z') {
assert(is_validuserid(cuser.userid));
assert(!invalidaddr(address));
@@ -2306,7 +2308,7 @@ doforward(const char *direct, const fileheader_t * fh, int mode)
strlcpy(fname, direct, sizeof(fname));
#endif
} else if (mode == 'U') {
- char tmp_buf[128];
+ char tmp_buf[PATHLEN];
snprintf(fname, sizeof(fname), "/tmp/bbs.uu%05d", (int)currpid);
snprintf(tmp_buf, sizeof(tmp_buf),
@@ -2314,10 +2316,14 @@ doforward(const char *direct, const fileheader_t * fh, int mode)
direct, fh->filename, (int)currpid, fname);
system(tmp_buf);
} else if (mode == 'F') {
- char tmp_buf[128];
+ char tmp_buf[PATHLEN];
snprintf(fname, sizeof(fname), "/tmp/bbs.f%05d", (int)currpid);
snprintf(tmp_buf, sizeof(tmp_buf), "%s/%s", direct, fh->filename);
+ if (!dashf(tmp_buf)) {
+ unlink(fname);
+ return -1;
+ }
Copy(tmp_buf, fname);
} else
return -1;