[virt-tools-list] [vhostmd virtio PATCH v3 1/6] Initialize allocated buffer

Michael Trapp Michael.Trapp at sap.com
Tue Nov 27 14:06:11 UTC 2018


buffer_grow uses realloc to extend the buffer, due to the fact that
realloc doesn't guarantee that allocated memory is initialized there
should be a memset.
---
 vhostmd/util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vhostmd/util.c b/vhostmd/util.c
index 70fc804..804c483 100644
--- a/vhostmd/util.c
+++ b/vhostmd/util.c
@@ -53,6 +53,7 @@ static int buffer_grow(vu_buffer *buf, int len)
         return -1;
 
     buf->size = size;
+    memset(&buf->content[buf->use], 0, len);
     return 0;
 }
 
-- 
2.17.2 (Apple Git-113)




More information about the virt-tools-list mailing list