diff options
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -660,7 +660,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; @@ -1572,7 +1572,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: { |