summaryrefslogtreecommitdiffstats
path: root/mbbsd/mail.c
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-09 18:05:46 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-09 18:05:46 +0800
commitd4655322c745b6a78706369c5b1926962d0c61c2 (patch)
tree698ebb898c43ade6bed1739f7eb2c57753fbb813 /mbbsd/mail.c
parent2ce96d4a0ce438e1b76fcd7481f91fd7841b84f3 (diff)
downloadpttbbs-d4655322c745b6a78706369c5b1926962d0c61c2.tar
pttbbs-d4655322c745b6a78706369c5b1926962d0c61c2.tar.gz
pttbbs-d4655322c745b6a78706369c5b1926962d0c61c2.tar.bz2
pttbbs-d4655322c745b6a78706369c5b1926962d0c61c2.tar.lz
pttbbs-d4655322c745b6a78706369c5b1926962d0c61c2.tar.xz
pttbbs-d4655322c745b6a78706369c5b1926962d0c61c2.tar.zst
pttbbs-d4655322c745b6a78706369c5b1926962d0c61c2.zip
add modifier "const" to some constant
remove a static char array of 60 bytes from mail.c:doforward avoid DDOS in mail.c:send_inner_mail git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2321 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r--mbbsd/mail.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 94f936cd..5ba76b17 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -1388,6 +1388,13 @@ send_inner_mail(char *fpath, char *title, char *receiver)
if (!searchuser(receiver))
return -2;
+
+ sethomedir(genbuf, receiver);
+ // XXX should we use MAX_EXKEEPMAIL instead?
+ if (dashs(genbuf) >= 2048 * sizeof(fileheader_t)) {
+ return -2;
+ }
+
sethomepath(genbuf, receiver);
stampfile(genbuf, &mymail);
if (!strcmp(receiver, cuser.userid)) {
@@ -1522,13 +1529,12 @@ bsmtp(char *fpath, char *title, char *rcpt, int method)
int
doforward(char *direct, fileheader_t * fh, int mode)
{
- static char address[60];
+ char address[60];
char fname[500];
int return_no;
char genbuf[200];
- if (!address[0])
- strlcpy(address, cuser.email, sizeof(address));
+ strlcpy(address, cuser.email, sizeof(address));
if( mode == 'U' ){
vmsg("將進行 uuencode 。若您不清楚什麼是 uuencode 請改用 F轉寄。");
@@ -1554,7 +1560,7 @@ doforward(char *direct, fileheader_t * fh, int mode)
strlcpy(address, fname, sizeof(address));
else
snprintf(address, sizeof(address),
- "%s.bbs@%s", fname, MYHOSTNAME);
+ "%s.bbs@%s", fname, MYHOSTNAME);
} else {
vmsg("取消轉寄");
return 1;
@@ -1682,7 +1688,7 @@ mail_justify(userec_t muser)
#ifndef USE_BSMTP
bbs_sendmail(NULL, title, muser.email)
#else
- bsmtp(NULL, title, muser.email, MQ_JUSTIFY);
+ bsmtp(NULL, title, muser.email, MQ_JUSTIFY)
#endif
<0)
Link("etc/bademail", buf1);