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
commit1e9a3ab393d34898d09a93453fe7b7c96aebf886 (patch)
treedd32cea1ed3af2402a66dbaa5644ee02f43570cc
parent596f84066e076f9a9cc134f0f0aa7d209e2c40d7 (diff)
downloadpttbbs-1e9a3ab393d34898d09a93453fe7b7c96aebf886.tar
pttbbs-1e9a3ab393d34898d09a93453fe7b7c96aebf886.tar.gz
pttbbs-1e9a3ab393d34898d09a93453fe7b7c96aebf886.tar.bz2
pttbbs-1e9a3ab393d34898d09a93453fe7b7c96aebf886.tar.lz
pttbbs-1e9a3ab393d34898d09a93453fe7b7c96aebf886.tar.xz
pttbbs-1e9a3ab393d34898d09a93453fe7b7c96aebf886.tar.zst
pttbbs-1e9a3ab393d34898d09a93453fe7b7c96aebf886.zip
prevent array index out of boundary when defined MEM_CHECK
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@587 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/board.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pttbbs/mbbsd/board.c b/pttbbs/mbbsd/board.c
index ebb4e851..57a521cc 100644
--- a/pttbbs/mbbsd/board.c
+++ b/pttbbs/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;