From 86618fc1fff4cc2379bd65fe113e5586f34b4bc5 Mon Sep 17 00:00:00 2001 From: kcwu Date: Thu, 26 Dec 2002 06:16:13 +0000 Subject: prevent array index out of boundary when defined MEM_CHECK git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@587 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/board.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/board.c b/mbbsd/board.c index ebb4e851..57a521cc 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -1,4 +1,4 @@ -/* $Id: board.c,v 1.62 2002/12/10 12:06:19 in2 Exp $ */ +/* $Id: board.c,v 1.63 2002/12/26 06:16:13 kcwu Exp $ */ #include "bbs.h" #define BRC_STRLEN 15 /* Length of board name */ #define BRC_MAXSIZE 24576 @@ -234,7 +234,7 @@ void load_brdbuf(void) size = (numboards + 32) * sizeof(int); #ifdef MEM_CHECK - size += 4; + size += sizeof(int); #endif zapbuf = (int *)malloc(size); favbuf = (int *)malloc(size); @@ -242,6 +242,7 @@ void load_brdbuf(void) zapbuf[0] = favbuf[0] = MEM_CHECK; zapbuf = &zapbuf[1]; favbuf = &favbuf[1]; + size -= sizeof(int); #endif zapchange = favchange = 0; -- cgit v1.2.3