From b6ac928a53d146233741fc5f7fe1cac66de27303 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Sun, 14 Dec 2014 10:27:32 -0500 Subject: Stop allocating an extra wasted byte at the end of various strings. --- builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin.c') diff --git a/builtin.c b/builtin.c index 21c6ed5c..838ab899 100644 --- a/builtin.c +++ b/builtin.c @@ -1833,7 +1833,7 @@ do_substr(int nargs) * way to do things. */ memset(& mbs, 0, sizeof(mbs)); - emalloc(substr, char *, (length * gawk_mb_cur_max) + 2, "do_substr"); + emalloc(substr, char *, (length * gawk_mb_cur_max) + 1, "do_substr"); wp = t1->wstptr + indx; for (cp = substr; length > 0; length--) { result = wcrtomb(cp, *wp, & mbs); -- cgit v1.2.3