From d3165ee5a5bf8d23d85bcbecff9392eca2e441b5 Mon Sep 17 00:00:00 2001 From: scw Date: Sun, 1 Aug 2004 07:40:43 +0000 Subject: Use alloca() to get needed buffer instead of fix-size array on stack avoiding stack grows too fast. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2154 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/brc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mbbsd') diff --git a/mbbsd/brc.c b/mbbsd/brc.c index 7ba1f40e..b3be8101 100644 --- a/mbbsd/brc.c +++ b/mbbsd/brc.c @@ -130,9 +130,10 @@ brc_putrecord(char *ptr, char *endp, brcbid_t bid, brcnbrd_t num, const time_t * static inline int brc_enlarge_buf() { - char buffer[BRC_MAXSIZE - BRC_BLOCKSIZE]; + char *buffer; if (brc_alloc >= BRC_MAXSIZE) return 0; + buffer = (char*)alloca(brc_alloc); memcpy(buffer, brc_buf, brc_alloc); free(brc_buf); brc_alloc += BRC_BLOCKSIZE; -- cgit v1.2.3