diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-08-01 15:40:43 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-08-01 15:40:43 +0800 |
commit | d3165ee5a5bf8d23d85bcbecff9392eca2e441b5 (patch) | |
tree | 5cdbc38cb07ab66071f753421bcfd1c523e4628c /mbbsd | |
parent | c0c9d87226fcdd179335b6f7356499ce05219b09 (diff) | |
download | pttbbs-d3165ee5a5bf8d23d85bcbecff9392eca2e441b5.tar pttbbs-d3165ee5a5bf8d23d85bcbecff9392eca2e441b5.tar.gz pttbbs-d3165ee5a5bf8d23d85bcbecff9392eca2e441b5.tar.bz2 pttbbs-d3165ee5a5bf8d23d85bcbecff9392eca2e441b5.tar.lz pttbbs-d3165ee5a5bf8d23d85bcbecff9392eca2e441b5.tar.xz pttbbs-d3165ee5a5bf8d23d85bcbecff9392eca2e441b5.tar.zst pttbbs-d3165ee5a5bf8d23d85bcbecff9392eca2e441b5.zip |
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
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/brc.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |