[vhostmd virtio PATCH v3 1/6] Initialize allocated buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.1 (Apple Git-112)

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux