From ef6edab2f38e84e240b05f587d79dacd04f44c2e Mon Sep 17 00:00:00 2001 From: wens Date: Mon, 4 Aug 2008 03:49:03 +0000 Subject: 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 --- mbbsd/mail.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'mbbsd/mail.c') 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); -- cgit v1.2.3