summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2011-10-14 23:52:04 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2011-10-14 23:52:04 +0800
commit627bef7941df54a62581d9796c369f85d634b5a9 (patch)
treed784ee49a46014b1e58ea11f323531ab45add91f
parent8c6694c7b42b12ef7fe58ce8c79b879ae767e681 (diff)
downloadpttbbs-627bef7941df54a62581d9796c369f85d634b5a9.tar
pttbbs-627bef7941df54a62581d9796c369f85d634b5a9.tar.gz
pttbbs-627bef7941df54a62581d9796c369f85d634b5a9.tar.bz2
pttbbs-627bef7941df54a62581d9796c369f85d634b5a9.tar.lz
pttbbs-627bef7941df54a62581d9796c369f85d634b5a9.tar.xz
pttbbs-627bef7941df54a62581d9796c369f85d634b5a9.tar.zst
pttbbs-627bef7941df54a62581d9796c369f85d634b5a9.zip
fix: crash when title is constant
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5434 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/bbs.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index a887e8ac..ae7471b6 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -581,6 +581,7 @@ readdoent(int num, fileheader_t * ent)
char *typeattr = "";
char isunread = 0, oisunread = 0;
int w = 0;
+ int const_title = 0;
#ifdef SAFE_ARTICLE_DELETE
// TODO maybe we should also check .filename because admin can't change that
@@ -659,7 +660,14 @@ readdoent(int num, fileheader_t * ent)
type = '+';
}
- title = ent->filename[0]!='L' ? subject_ex(ent->title, &title_type) : "<本文鎖定>";
+ if (ent->filename[0]!='L') {
+ title = "<本文鎖定>";
+ const_title = 1;
+ } else {
+ title = subject_ex(ent->title, &title_type);
+ }
+
+
#ifdef SAFE_ARTICLE_DELETE
if (iscorpse)
color = '0', mark = "□";
@@ -760,7 +768,8 @@ readdoent(int num, fileheader_t * ent)
}
// strip unsafe characters
- strip_nonebig5((char*)title, INT_MAX);
+ if (!const_title)
+ strip_nonebig5((char*)title, INT_MAX);
// print subject, bounded by w.
if (strlen(title) > w) {