summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-02-15 09:51:10 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-02-15 09:51:10 +0800
commite0724377611ce98cd99154e60d441b44614e165b (patch)
treec4503297abb3b23ad1458069e2982d611861a58c /mbbsd
parentf0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b (diff)
downloadpttbbs-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.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 3d6a36c5..66418259 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -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;