From 82641a1c661cbf4749fb823061de37d224a9c50f Mon Sep 17 00:00:00 2001 From: IepIweidieng <37586669+IepIweidieng@users.noreply.github.com> Date: Sat, 4 May 2019 04:43:24 +0800 Subject: [PATCH] maple/board.c: `class_body()`: `tmp[]`: Fix possible out-of-bound array accessing. --- maple/board.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/maple/board.c b/maple/board.c index 90285f698..622ee4f80 100644 --- a/maple/board.c +++ b/maple/board.c @@ -1230,13 +1230,14 @@ class_body( str = brd->blast > brd_visit[chn] ? "\x1b[1;31m★\x1b[m" : "☆"; char tmp[BTLEN + 1] = {0}; + int e_cols = (d_cols + 32 > BTLEN) ? BTLEN - 32 : d_cols; strcpy(tmp, brd->title); - if (tmp[d_cols + 31] & 0x80) -// tmp[d_cols + 33] = '\0'; + if (tmp[e_cols + 31] & 0x80) +// tmp[e_cols + 33] = '\0'; // else - tmp[d_cols + 31] = ' '; - tmp[d_cols + 32] = '\0'; + tmp[e_cols + 31] = ' '; + tmp[e_cols + 32] = '\0'; /* 081122.cache:看板性質, 不訂閱, 秘密, 好友, 一般 */ if (bits[chn] & BRD_Z_BIT)