diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-02-15 09:51:10 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-02-15 09:51:10 +0800 |
commit | e0724377611ce98cd99154e60d441b44614e165b (patch) | |
tree | c4503297abb3b23ad1458069e2982d611861a58c /mbbsd | |
parent | f0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b (diff) | |
download | pttbbs-e0724377611ce98cd99154e60d441b44614e165b.tar pttbbs-e0724377611ce98cd99154e60d441b44614e165b.tar.gz pttbbs-e0724377611ce98cd99154e60d441b44614e165b.tar.bz2 pttbbs-e0724377611ce98cd99154e60d441b44614e165b.tar.lz pttbbs-e0724377611ce98cd99154e60d441b44614e165b.tar.xz pttbbs-e0724377611ce98cd99154e60d441b44614e165b.tar.zst pttbbs-e0724377611ce98cd99154e60d441b44614e165b.zip |
- testing to narrow down buffer overrun reason
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3921 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/io.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -6,13 +6,21 @@ #define OBUFSIZE 3072 #define IBUFSIZE 128 +/* realXbuf is Xbuf+3 because hz convert library requires buf[-2]. */ +#define CVTGAP (3) + #ifdef DEBUG #define register #endif -/* realXbuf is Xbuf+3 because hz convert library requires buf[-2]. */ -static unsigned char real_outbuf[OBUFSIZE+6] = " ", real_inbuf[IBUFSIZE+6] = " "; -static unsigned char *outbuf = real_outbuf + 3, *inbuf = real_inbuf + 3; +static unsigned char real_outbuf[OBUFSIZE + CVTGAP*2] = " ", + real_inbuf [IBUFSIZE + CVTGAP*2] = " "; + +// use defines instead - it is discovered that sometimes the input/output buffer was overflow, +// without knowing why. +// static unsigned char *outbuf = real_outbuf + 3, *inbuf = real_inbuf + 3; +#define inbuf (real_inbuf +CVTGAP) +#define outbuf (real_outbuf+CVTGAP) static int obufsize = 0, ibufsize = 0; static int icurrchar = 0; |