[Spice-devel] [spice-gtk 1/4] coverity: fix unitialized use of mem.data
Frediano Ziglio
fziglio at redhat.com
Mon Apr 25 09:04:00 UTC 2016
>
> ---
> src/channel-main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/channel-main.c b/src/channel-main.c
> index 4a1f58a..93537d2 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -1021,9 +1021,9 @@ static void agent_msg_queue_many(SpiceMainChannel
> *channel, int type, const void
> }
> va_end(args);
>
> + memset(&msg, 0, sizeof(VDAgentMessage));
> msg.protocol = VD_AGENT_PROTOCOL;
> msg.type = type;
> - msg.opaque = 0;
> msg.size = size;
>
> paysize = MIN(VD_AGENT_MAX_DATA_SIZE, size + sizeof(VDAgentMessage));
The definition is this
typedef struct SPICE_ATTR_PACKED VDAgentMessage {
uint32_t protocol;
uint32_t type;
uint64_t opaque;
uint32_t size;
uint8_t data[0];
} VDAgentMessage;
So I would say it's a false positive! data is 0 size the memset can't help.
Frediano
More information about the Spice-devel
mailing list