From: Fredrik Tolf Date: Sun, 30 Oct 2016 20:08:26 +0000 (+0100) Subject: lib: Fixed bioprintf bug. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=f9db90c1c6edeb2cdf7a89d13b07e53197ed351a;p=ashd.git lib: Fixed bioprintf bug. --- 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); } }