]> git.ozlabs.org Git - ccan/blobdiff - ccan/tal/str/str.c
tal/str: fix infinite loop of tal_fmt() with empty string.
[ccan] / ccan / tal / str / str.c
index 83dac663f7175d6c95a21a17f3337f61e26aebc0..7adb9ef5aefbf990067a1dc80569dbba6f679587 100644 (file)
@@ -52,7 +52,7 @@ char *tal_fmt(const tal_t *ctx, const char *fmt, ...)
 static bool do_vfmt(char **buf, size_t off, const char *fmt, va_list ap)
 {
        /* A decent guess to start. */
-       size_t max = strlen(fmt) * 2;
+       size_t max = strlen(fmt) * 2 + 1;
        bool ok;
 
        for (;;) {