From f9db90c1c6edeb2cdf7a89d13b07e53197ed351a Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Sun, 30 Oct 2016 21:08:26 +0100 Subject: [PATCH] lib: Fixed bioprintf bug. --- lib/bufio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bufio.c b/lib/bufio.c index c08e9dd..11d8c04 100644 --- a/lib/bufio.c +++ b/lib/bufio.c @@ -289,11 +289,11 @@ int bioprintf(struct bufio *bio, const char *format, ...) va_start(args, format); ret = vsnprintf(bio->wbuf.b + bio->wbuf.d, bio->wbuf.s - bio->wbuf.d, format, args); va_end(args); - if(ret <= bio->wbuf.s - bio->wbuf.d) { + if(ret < bio->wbuf.s - bio->wbuf.d) { bio->wbuf.d += ret; return(0); } - if(biowensure(bio, ret) < 0) + if(biowensure(bio, ret + 1) < 0) return(-1); } } -- 2.11.0