summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/mbbsd/record.c16
-rw-r--r--pttbbs/mbbsd/register.c1
2 files changed, 8 insertions, 9 deletions
diff --git a/pttbbs/mbbsd/record.c b/pttbbs/mbbsd/record.c
index 8fcb80e1..52317df9 100644
--- a/pttbbs/mbbsd/record.c
+++ b/pttbbs/mbbsd/record.c
@@ -495,7 +495,7 @@ int
append_record_forward(char *fpath, fileheader_t * record, int size, const char *origid)
{
FILE *fp;
- char buf[512];
+ char buf[PATHLEN];
int n;
char address[64] = "";
char fwd_title[STRLEN] = "";
@@ -503,18 +503,17 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
// No matter what, append it, and return if that failed.
r = append_record(fpath, record, size);
- if (r != 0)
+ if (r < 0)
return r;
// #ifdef USE_MAIL_AUTO_FORWARD
- // Try to build .forward
- for (n = strlen(fpath) - 1; fpath[n] != '/' && n > 0; n--);
- if (n + strlen(FN_FORWARD) + 1 > sizeof(buf))
+ if (strlen(fpath) + strlen(FN_FORWARD) >= PATHLEN) {
+ log_filef("log/invalid_append_record_forward", LOG_CREAT,
+ "%s %s %s\n", Cdatelite(&now), cuser.userid, fpath);
return -1;
-
- memcpy(buf, fpath, n+1);
- strcpy(buf + n + 1, FN_FORWARD);
+ }
+ setdirpath(buf, fpath, FN_FORWARD);
fp = fopen(buf, "r");
if (!fp)
return 0;
@@ -523,6 +522,7 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
address[0] = 0;
fscanf(fp, "%63s", address);
fclose(fp);
+ chomp(address);
strip_blank(address, address);
#ifdef UNTRUSTED_FORWARD_TIMEBOMB
diff --git a/pttbbs/mbbsd/register.c b/pttbbs/mbbsd/register.c
index fc0fb4db..91504d27 100644
--- a/pttbbs/mbbsd/register.c
+++ b/pttbbs/mbbsd/register.c
@@ -605,7 +605,6 @@ new_register(void)
#ifdef MIN_ALLOWED_ID_LEN
else if (strlen(passbuf) < MIN_ALLOWED_ID_LEN)
prints("代號過短,請使用 %d 個字元以上的代號\n", MIN_ALLOWED_ID_LEN);
- // prints("此代號已由系統保留,請使用別的代號\n");
#endif
else // success
break;