]> mj.ucw.cz Git - libucw.git/commitdiff
Fixed a bug in mp_printf_append(). Thanks to Dan.
authorPavel Charvat <pchar@ucw.cz>
Tue, 2 Dec 2008 11:50:59 +0000 (12:50 +0100)
committerPavel Charvat <pchar@ucw.cz>
Tue, 2 Dec 2008 11:50:59 +0000 (12:50 +0100)
ucw/mempool-fmt.c

index 04345687f85e7f597c741b1ca214d6afbb44d91b..ba0e7877dfdbfd8cb5750cb4d471005dc70b2ff3 100644 (file)
@@ -37,7 +37,7 @@ mp_vprintf_at(struct mempool *mp, uns ofs, const char *fmt, va_list args)
     }
   else if ((uns)cnt >= mp_avail(mp) - ofs)
     {
-      ret = mp_grow(mp, cnt + 1) + ofs;
+      ret = mp_grow(mp, ofs + cnt + 1) + ofs;
       va_copy(args2, args);
       int cnt2 = vsnprintf(ret, cnt + 1, fmt, args2);
       va_end(args2);