summaryrefslogtreecommitdiffstats
path: root/mbbsd/mail.c
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-08-04 11:49:03 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-08-04 11:49:03 +0800
commitef6edab2f38e84e240b05f587d79dacd04f44c2e (patch)
tree48e6323f761ac1d66627933dbd1ee9d229d59566 /mbbsd/mail.c
parent3cfbc9d6e1b548904c323e8c9a782ca0e82e1c4f (diff)
downloadpttbbs-ef6edab2f38e84e240b05f587d79dacd04f44c2e.tar
pttbbs-ef6edab2f38e84e240b05f587d79dacd04f44c2e.tar.gz
pttbbs-ef6edab2f38e84e240b05f587d79dacd04f44c2e.tar.bz2
pttbbs-ef6edab2f38e84e240b05f587d79dacd04f44c2e.tar.lz
pttbbs-ef6edab2f38e84e240b05f587d79dacd04f44c2e.tar.xz
pttbbs-ef6edab2f38e84e240b05f587d79dacd04f44c2e.tar.zst
pttbbs-ef6edab2f38e84e240b05f587d79dacd04f44c2e.zip
Don't modify Vector data; use temporary buffer.
Is second searchuser really nessecary? git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4393 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r--mbbsd/mail.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index d598c9a7..d0eecd2f 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -616,10 +616,11 @@ multi_send(char *title)
fileheader_t mymail;
char fpath[TTLEN], *ptr;
int recipient, listing;
- char genbuf[256];
+ char genbuf[PATHLEN];
+ char buf[IDLEN+1];
struct Vector namelist;
int i;
- char *p;
+ const char *p;
Vector_init(&namelist, IDLEN+1);
listing = recipient = 0;
@@ -709,16 +710,14 @@ multi_send(char *title)
outc(' ');
}
outs(p);
- // XXX p points to string in vector
- // searchuser modifies it
- if (searchuser(p, p) && strcmp(STR_GUEST, p)) {
- sethomefile(genbuf, p, FN_OVERRIDES);
+ if (searchuser(p, buf) && strcmp(STR_GUEST, buf)) {
+ sethomefile(genbuf, buf, FN_OVERRIDES);
if (!file_exist_record(genbuf, cuser.userid)) { // not friend, check if rejected
- sethomefile(genbuf, p, FN_REJECT);
+ sethomefile(genbuf, buf, FN_REJECT);
if (file_exist_record(genbuf, cuser.userid))
continue;
}
- sethomepath(genbuf, p);
+ sethomepath(genbuf, buf);
} else
continue;
stampfile(genbuf, &mymail);
@@ -728,10 +727,10 @@ multi_send(char *title)
strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner));
strlcpy(mymail.title, save_title, sizeof(mymail.title));
mymail.filemode |= FILE_MULTI; /* multi-send flag */
- sethomedir(genbuf, p);
- if (append_record_forward(genbuf, &mymail, sizeof(mymail), p) == -1)
+ sethomedir(genbuf, buf);
+ if (append_record_forward(genbuf, &mymail, sizeof(mymail), buf) == -1)
vmsg(err_uid);
- sendalert(p, ALERT_NEW_MAIL);
+ sendalert(buf, ALERT_NEW_MAIL);
}
hold_mail(fpath, NULL);
unlink(fpath);