]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
[Dynbuf] Fix minor bug in DynBuf_GrowToFit
authorOliver Kurth <okurth@vmware.com>
Fri, 20 Dec 2019 20:25:50 +0000 (12:25 -0800)
committerOliver Kurth <okurth@vmware.com>
Fri, 20 Dec 2019 20:25:50 +0000 (12:25 -0800)
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.

open-vm-tools/lib/include/dynbuf.h

index 04bb9cc6bd9d457a435e465688ba149bbce7890b..b955a20a9341f458b34b63ff2f41c24c5cc4a440 100644 (file)
@@ -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)