diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-23 11:52:06 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-23 11:52:06 +0800 |
commit | 9ad97ad4b96e2a975f196d19cd43af34cd8beaca (patch) | |
tree | 8d89022be11e10f6e5218ef0b13a665de605b40a /mbbsd/mail.c | |
parent | 7dfb1cd0396127830a9ba1011f0febf702e61e75 (diff) | |
download | pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.gz pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.bz2 pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.lz pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.xz pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.zst pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.zip |
set*() family functions all assume buffer size = PATHLEN, to prevent buffer overflow.
do some s/256/PATHLEN/.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3074 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r-- | mbbsd/mail.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c index dd69aba9..f5d44c48 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -782,7 +782,7 @@ read_new_mail(void * voidfptr, void *optarg) fileheader_t *fptr=(fileheader_t*)voidfptr; struct ReadNewMailArg *arg=(struct ReadNewMailArg*)optarg; char done = NA, delete_it; - char fname[256]; + char fname[PATHLEN]; char genbuf[4]; arg->idc++; @@ -1313,7 +1313,7 @@ mail_man(void) static int mail_cite(int ent, fileheader_t * fhdr, const char *direct) { - char fpath[256]; + char fpath[PATHLEN]; char title[TTLEN + 1]; static char xboard[20]; char buf[20]; @@ -1354,7 +1354,7 @@ mail_cite(int ent, fileheader_t * fhdr, const char *direct) static int mail_save(int ent, fileheader_t * fhdr, const char *direct) { - char fpath[256]; + char fpath[PATHLEN]; char title[TTLEN + 1]; if (HasUserPerm(PERM_MAILLIMIT)) { @@ -1561,7 +1561,7 @@ m_read(void) static int send_inner_mail(const char *fpath, const char *title, const char *receiver) { - char genbuf[256]; + char fname[PATHLEN]; fileheader_t mymail; char rightid[IDLEN+1]; @@ -1569,18 +1569,18 @@ send_inner_mail(const char *fpath, const char *title, const char *receiver) return -2; /* to avoid DDOS of disk */ - sethomedir(genbuf, rightid); + sethomedir(fname, rightid); if (strcmp(rightid, cuser.userid) == 0) { if (chk_mailbox_limit()) return -2; } // XXX should we use MAX_EXKEEPMAIL instead? - else if (dashs(genbuf) >= 2048 * sizeof(fileheader_t)) { + else if (dashs(fname) >= 2048 * sizeof(fileheader_t)) { return -2; } - sethomepath(genbuf, rightid); - stampfile(genbuf, &mymail); + sethomepath(fname, rightid); + stampfile(fname, &mymail); if (!strcmp(rightid, cuser.userid)) { /* Using BBSNAME may be too loooooong. */ strlcpy(mymail.owner, "[¯¸¤º]", sizeof(mymail.owner)); @@ -1588,10 +1588,10 @@ send_inner_mail(const char *fpath, const char *title, const char *receiver) } else strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner)); strncpy(mymail.title, title, TTLEN); - unlink(genbuf); - Copy(fpath, genbuf); - sethomedir(genbuf, rightid); - return append_record_forward(genbuf, &mymail, sizeof(mymail), rightid); + unlink(fname); + Copy(fpath, fname); + sethomedir(fname, rightid); + return append_record_forward(fname, &mymail, sizeof(mymail), rightid); } #include <netdb.h> |