之前我装的BBS在执行封禁的时候会导致服务端挂掉,经过检查之后发现代码中
居然出现了数组越界的错误。
int select_deny_reason(char reason[][STRLEN], char *denymsg, int count)
{
struct _select_item sel[count+2];
struct _select_def conf;
struct _simple_select_arg arg;
POINT pts[count+2];
char menustr[count+2][STRLEN];
int i, ret, pos;
for (i=0;i<count+2;i++) {
sel[i].x = (i<10) ? 2 : 40;
sel[i].y = (i<10) ? 4 + i : i - 6;
sel[i].hotkey = (i<9) ? '1' + i : 'A' + i - 9;
sel[i].type = SIT_SELECT;
sel[i].data = menustr[i];
if (i==count)
sprintf(menustr[i], "\033[33m[%c] %s\033[m", sel[i].hotkey, "手动输入封禁理由");
else if (i==count+1)
sprintf(menustr[i], "\033[31m[%c] %s\033[m", sel[i].hotkey, "放弃此次封禁操作");
else
sprintf(menustr[i], "[%c] %s", sel[i].hotkey, reason[i]);
pts[i].x = sel[i].x;
pts[i].y = sel[i].y;
}
sel[i].x = -1;
sel[i].y = -1;
sel[i].hotkey = -1;
sel[i].type = 0;
sel[i].data = NULL;
--
修改:ArchLinux FROM 124.205.76.*
FROM 124.205.77.*