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

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



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 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]