From: Oliver Kurth Date: Fri, 20 Dec 2019 20:25:50 +0000 (-0800) Subject: [Dynbuf] Fix minor bug in DynBuf_GrowToFit X-Git-Tag: stable-11.1.0~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78a0386068bf4438264941b9a4687d76cf2dcd42;p=thirdparty%2Fopen-vm-tools.git [Dynbuf] Fix minor bug in DynBuf_GrowToFit DynBuf_GrowToFit tries to provide a dynbuf with size greater than the given size. However, the second argument passed to DynBuf_Enlarge doesn't match the intention. The size should be directly passed, not the difference between the target and current size. --- diff --git a/open-vm-tools/lib/include/dynbuf.h b/open-vm-tools/lib/include/dynbuf.h index 04bb9cc6b..b955a20a9 100644 --- a/open-vm-tools/lib/include/dynbuf.h +++ b/open-vm-tools/lib/include/dynbuf.h @@ -410,10 +410,9 @@ static Bool static INLINE Bool #endif DynBuf_GrowToFit(DynBuf *buf, // IN/OUT - uint32 size) // IN + size_t size) // IN { - return buf->allocated >= size ? - TRUE : DynBuf_Enlarge(buf, size - buf->allocated); + return buf->allocated >= size ? TRUE : DynBuf_Enlarge(buf, size); } #if defined(__cplusplus)