summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-12-26 14:16:13 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-12-26 14:16:13 +0800
commit86618fc1fff4cc2379bd65fe113e5586f34b4bc5 (patch)
tree1c5e5d076c511c727943ce6ef7d4926e2096be8b
parent0c9a5afdb43e78dce133dfa46a67d4acbef323b8 (diff)
downloadpttbbs-86618fc1fff4cc2379bd65fe113e5586f34b4bc5.tar
pttbbs-86618fc1fff4cc2379bd65fe113e5586f34b4bc5.tar.gz
pttbbs-86618fc1fff4cc2379bd65fe113e5586f34b4bc5.tar.bz2
pttbbs-86618fc1fff4cc2379bd65fe113e5586f34b4bc5.tar.lz
pttbbs-86618fc1fff4cc2379bd65fe113e5586f34b4bc5.tar.xz
pttbbs-86618fc1fff4cc2379bd65fe113e5586f34b4bc5.tar.zst
pttbbs-86618fc1fff4cc2379bd65fe113e5586f34b4bc5.zip
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
-rw-r--r--mbbsd/board.c5
1 files changed, 3 insertions, 2 deletions
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;