diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-27 17:34:36 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-27 17:34:36 +0800 |
commit | 01ff073c35b89ad6662c78efac10d6b632f53048 (patch) | |
tree | 0215d0f8ee7671cf8096ac65be9db5b21ff6e207 | |
parent | f6a47ff69ef962592ec95cf3b54075b274779eaa (diff) | |
download | pttbbs-01ff073c35b89ad6662c78efac10d6b632f53048.tar pttbbs-01ff073c35b89ad6662c78efac10d6b632f53048.tar.gz pttbbs-01ff073c35b89ad6662c78efac10d6b632f53048.tar.bz2 pttbbs-01ff073c35b89ad6662c78efac10d6b632f53048.tar.lz pttbbs-01ff073c35b89ad6662c78efac10d6b632f53048.tar.xz pttbbs-01ff073c35b89ad6662c78efac10d6b632f53048.tar.zst pttbbs-01ff073c35b89ad6662c78efac10d6b632f53048.zip |
* fix: 'found nothing' after search 3-4 levels
* reason: sizeof(currdirect)<64> != sizeof(newdirect)<PATHLEN>
* simply added message, not extending currdirect to prevent very long filenames
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@4885 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/mbbsd/read.c | 17 | ||||
-rw-r--r-- | pttbbs/mbbsd/var.c | 2 |
2 files changed, 16 insertions, 3 deletions
diff --git a/pttbbs/mbbsd/read.c b/pttbbs/mbbsd/read.c index 4616cd62..ba9aa67e 100644 --- a/pttbbs/mbbsd/read.c +++ b/pttbbs/mbbsd/read.c @@ -423,7 +423,6 @@ select_read(const keeploc_t * locmem, int sr_mode) char keyword[TTLEN + 1] = ""; int n_recommend = 0, n_money = 0; - if(locmem->crs_ln == 0) return locmem->crs_ln; @@ -501,8 +500,22 @@ select_read(const keeploc_t * locmem, int sr_mode) snprintf(genbuf, sizeof(genbuf), "%s%X.%X.%X", first_select ? "SR.":p, sr_mode, (int)strlen(keyword), DBCS_StringHash(keyword)); - if( strlen(genbuf) > PATHLEN - 50 ) + + // pre-calculate board prefix + if (currstat == RMAIL) + sethomefile(newdirect, cuser.userid, "x"); + else + setbfile(newdirect, currboard, "x"); + + // XXX currently currdirect is 64 bytes while newdirect is 256 bytes. + // however if we enlarge currdirect, there may be lots of SR generated. + // as a result, let's make restriction here. + assert( sizeof(newdirect) >= sizeof(currdirect) ); + if( strlen(genbuf) + strlen(newdirect) >= sizeof(currdirect) ) + { + vmsg("抱歉,已達搜尋條件上限。"); return READ_REDRAW; // avoid overflow + } if (currstat == RMAIL) sethomefile(newdirect, cuser.userid, genbuf); diff --git a/pttbbs/mbbsd/var.c b/pttbbs/mbbsd/var.c index c46cde6a..b9d8ad74 100644 --- a/pttbbs/mbbsd/var.c +++ b/pttbbs/mbbsd/var.c @@ -361,7 +361,7 @@ userinfo_t *currutmp; int TagNum = 0; /* tag's number */ int TagBoard = -1; /* TagBoard = 0 : user's mailbox */ /* TagBoard > 0 : bid where last taged */ -char currdirect[64]; +char currdirect[64]; /* XXX TODO change this to PATHLEN? */ /* bbs.c */ char real_name[IDLEN + 1]; |