X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftal%2Fstr%2Fstr.c;h=cec31c752bbe104b3a457ec25f62da7df4d172ef;hp=b00775ab70fc4d652e8739027dc99d813a28d2c9;hb=55d814230f7fb628bb5303cd53498209c7928040;hpb=1651e25ee7cf7a24692e7ffa0c6fc9a47218eb6d diff --git a/ccan/tal/str/str.c b/ccan/tal/str/str.c index b00775ab..cec31c75 100644 --- a/ccan/tal/str/str.c +++ b/ccan/tal/str/str.c @@ -68,6 +68,8 @@ static bool do_vfmt(char **buf, size_t off, const char *fmt, va_list ap) if (ret < max) { ok = true; + /* Make sure tal_count() is correct! */ + tal_resize(buf, off + ret + 1); break; } max *= 2; @@ -222,6 +224,8 @@ char *tal_strjoin_(const tal_t *ctx, totlen += dlen; } ret[totlen] = '\0'; + /* Make sure tal_count() is correct! */ + tal_resize(&ret, totlen+1); out: if (taken(strings)) tal_free(strings);