summaryrefslogtreecommitdiffstats
path: root/mbbsd/mail.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-27 08:53:03 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-27 08:53:03 +0800
commit3e774d4829229f4132e3b6895b572a117f60c99d (patch)
tree2f94783d37a64eb4b32ffe16b4b8b60855a63239 /mbbsd/mail.c
parentfc4a128e1360ba9b3098656b35721323f173838f (diff)
downloadpttbbs-3e774d4829229f4132e3b6895b572a117f60c99d.tar
pttbbs-3e774d4829229f4132e3b6895b572a117f60c99d.tar.gz
pttbbs-3e774d4829229f4132e3b6895b572a117f60c99d.tar.bz2
pttbbs-3e774d4829229f4132e3b6895b572a117f60c99d.tar.lz
pttbbs-3e774d4829229f4132e3b6895b572a117f60c99d.tar.xz
pttbbs-3e774d4829229f4132e3b6895b572a117f60c99d.tar.zst
pttbbs-3e774d4829229f4132e3b6895b572a117f60c99d.zip
- code clean up
- enlarge buffer size to prevent overflow git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4030 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r--mbbsd/mail.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 38e19619..1f5f8f96 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -2,7 +2,7 @@
#include "bbs.h"
static int mailkeep = 0, mailsum = 0;
static int mailsumlimit = 0, mailmaxkeep = 0;
-static char currmaildir[32];
+static char currmaildir[PATHLEN];
static char msg_cc[] = ANSI_COLOR(32) "[¸s²Õ¦W³æ]" ANSI_RESET "\n";
static char listfile[] = "list.0";
@@ -21,13 +21,13 @@ static int showmail_mode = SHOWMAIL_NORM;
int
setforward(void)
{
- char buf[80], ip[50] = "", yn[4];
+ char buf[PATHLEN], ip[50] = "", yn[4];
FILE *fp;
int flIdiotSent2Self = 0;
int oidlen = strlen(cuser.userid);
sethomepath(buf, cuser.userid);
- strcat(buf, "/.forward");
+ strlcat(buf, "/.forward", sizeof(buf));
if ((fp = fopen(buf, "r"))) {
fscanf(fp, "%" toSTR(sizeof(ip)) "s", ip);
fclose(fp);
@@ -121,7 +121,7 @@ int
mail_id(const char *id, const char *title, const char *src, const char *owner)
{
fileheader_t mhdr;
- char dst[128], dirf[128];
+ char dst[PATHLEN], dirf[PATHLEN];
sethomepath(dst, id);
if (stampfile(dst, &mhdr))
return 0;
@@ -290,7 +290,8 @@ chkmailbox(void)
static void
do_hold_mail(const char *fpath, const char *receiver, const char *holder)
{
- char buf[80], title[128];
+ char buf[PATHLEN], title[128];
+ char holder_dir[PATHLEN];
fileheader_t mymail;
@@ -305,11 +306,11 @@ do_hold_mail(const char *fpath, const char *receiver, const char *holder)
} else
strlcpy(mymail.title, save_title, sizeof(mymail.title));
- sethomedir(title, holder);
+ sethomedir(holder_dir, holder);
unlink(buf);
Copy(fpath, buf);
- append_record_forward(title, &mymail, sizeof(mymail), holder);
+ append_record_forward(holder_dir, &mymail, sizeof(mymail), holder);
}
void
@@ -333,7 +334,7 @@ do_send(const char *userid, const char *title)
fileheader_t mhdr;
char fpath[STRLEN];
char receiver[IDLEN + 1];
- char genbuf[200];
+ char genbuf[PATHLEN];
int internet_mail, i;
userec_t xuser;
@@ -1307,7 +1308,7 @@ mail_reply(int ent, fileheader_t * fhdr, const char *direct)
static int
mail_edit(int ent, fileheader_t * fhdr, const char *direct)
{
- char genbuf[200];
+ char genbuf[PATHLEN];
if (!HasUserPerm(PERM_SYSOP))
return DONOTHING;