From 660963a04da68a4bea153961e2cd9e59b06faaab Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sun, 23 Apr 2017 13:36:54 +1000 Subject: [PATCH] Buffers should be big enough now --- bbs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bbs.c b/bbs.c index 8fa61c2..c1d86e2 100644 --- a/bbs.c +++ b/bbs.c @@ -234,12 +234,12 @@ void s_putchar(char c) { } } else { ic = iconv_open("UTF-8", "CP437"); - inbuf = (char *)malloc(3); - outbuf = (char *)malloc(3); - memset(outbuf, 0, 3); + inbuf = (char *)malloc(4); + outbuf = (char *)malloc(4); + memset(outbuf, 0, 4); sprintf(inbuf, "%c", c); inc = 1; - ouc = 3; + ouc = 4; ptr1 = outbuf; ptr2 = inbuf; sz = iconv(ic, &inbuf, &inc, &outbuf, &ouc); @@ -273,11 +273,11 @@ void s_putstring(char *c) { ic = iconv_open("UTF-8", "CP437"); inc = strlen(c); inbuf = strdup(c); - outbuf = (char *)malloc(inc * 2); - memset(outbuf, 0, inc *2); + outbuf = (char *)malloc(inc * 4); + memset(outbuf, 0, inc * 4); ptr1 = outbuf; ptr2 = inbuf; - ouc = inc * 2; + ouc = inc * 4; sz = iconv(ic, &inbuf, &inc, &outbuf, &ouc); if (sshBBS) { fprintf(stdout, "%s", ptr1);