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

Re: [libvirt] [PATCH] Fix uninitialized value in QEMU monitor FD sending code



On 06/30/2011 08:10 AM, Daniel P. Berrange wrote:
> The 'char control[CMSG_SPACE(sizeof(int))];' was not being
> wiped, so could potentially contain uninitialized bytes.
> While this was harmless in this case, it caused complaints
> from valgrind
> 
> * src/qemu/qemu_monitor.c: memset 'control' variable
>   in qemuMonitorIOWriteWithFD
> ---
>  src/qemu/qemu_monitor.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index e995d97..8573262 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -383,6 +383,7 @@ qemuMonitorIOWriteWithFD(qemuMonitorPtr mon,
>      struct cmsghdr *cmsg;
>  
>      memset(&msg, 0, sizeof(msg));
> +    memset(control, 0, sizeof(control));
>  
>      iov[0].iov_base = (void *)data;
>      iov[0].iov_len = len;

ACK.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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