aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2016-05-03 12:32:35 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2016-05-03 12:32:35 -0400
commita9f8c06d673af6c51153bc8008e58276cecfef6b (patch)
treed64ec38e9f89a97c60c2f61e859da318de89023f /builtin.c
parent315f1d61de4e536642e1bcf9f10903e3dd4f584b (diff)
parenta6df7afc605079df7d85318846a522ef64aaa44d (diff)
downloadegawk-a9f8c06d673af6c51153bc8008e58276cecfef6b.tar.gz
egawk-a9f8c06d673af6c51153bc8008e58276cecfef6b.tar.bz2
egawk-a9f8c06d673af6c51153bc8008e58276cecfef6b.zip
Merge branch 'gawk-4.1-stable'
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin.c b/builtin.c
index 4256ee5e..31c13a81 100644
--- a/builtin.c
+++ b/builtin.c
@@ -670,7 +670,7 @@ format_tree(
int i, nc;
bool toofew = false;
char *obuf, *obufout;
- size_t osiz, ofre;
+ size_t osiz, ofre, olen_final;
const char *chbuf;
const char *s0, *s1;
int cs1;
@@ -1582,7 +1582,10 @@ mpf1:
_("too many arguments supplied for format string"));
}
bchunk(s0, s1 - s0);
- r = make_str_node(obuf, obufout - obuf, ALREADY_MALLOCED);
+ olen_final = obufout - obuf;
+ if (ofre > 0)
+ erealloc(obuf, char *, olen_final + 2, "format_tree");
+ r = make_str_node(obuf, olen_final, ALREADY_MALLOCED);
obuf = NULL;
out:
{