Re: [PATCH 2/3] Ensure RPC message is cleared before being reused

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

 



On 06/30/2011 05:29 AM, Daniel P. Berrange wrote:
> To save on memory reallocation, virNetMessage instances that
> have been transmitted, may be reused for a subsequent incoming
> message. We forgot to clear out the old data of the message
> fully, which caused later confusion upon read.
> 
> * src/rpc/virnetserverclient.c: memset entire message before
>   reusing it
> ---
>  src/rpc/virnetserverclient.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
> index aac4c3c..5c23cf2 100644
> --- a/src/rpc/virnetserverclient.c
> +++ b/src/rpc/virnetserverclient.c
> @@ -837,6 +837,7 @@ virNetServerClientDispatchWrite(virNetServerClientPtr client)
>                      client->nrequests < client->nrequests_max) {
>                      /* Ready to recv more messages */
>                      client->rx = msg;
> +                    memset(client->rx, 0, sizeof(*client->rx));
>                      client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;

ACK.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]