From 78bb6105f51ab157263d3eddb00801cef00c8292 Mon Sep 17 00:00:00 2001 From: piaip Date: Sat, 5 Apr 2008 03:50:54 +0000 Subject: - fix friend description length on screen git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4082 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/friend.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mbbsd/friend.c b/mbbsd/friend.c index 4ec98f9a..db36a8cc 100644 --- a/mbbsd/friend.c +++ b/mbbsd/friend.c @@ -74,15 +74,18 @@ friend_add(const char *uident, int type, const char* des) if ((uident[0] > ' ') && !belong(fpath, uident)) { char buf[STRLEN] = "", buf2[256]; char t_uident[IDLEN + 1]; + const maxdesclen = 40; // + + assert(maxdesclen <= sizeof(buf)); /* Thor: avoid uident run away when get data */ strlcpy(t_uident, uident, sizeof(t_uident)); if (type != FRIEND_ALOHA && type != FRIEND_POST){ if(!des) - getdata(2, 0, friend_desc[type], buf, sizeof(buf), DOECHO); + getdata(2, 0, friend_desc[type], buf, maxdesclen, DOECHO); else - getdata_str(2, 0, friend_desc[type], buf, sizeof(buf), DOECHO, des); + getdata_str(2, 0, friend_desc[type], buf, maxdesclen, DOECHO, des); } snprintf(buf2, sizeof(buf2), "%-13s%s\n", t_uident, buf); -- cgit v1.2.3