mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
Avoid use of uninitialized data in virnetmessagetest
If an error occurs in virnetmessagetest it was possible it would free uninitialized data. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
a93eb09a97
commit
b32ac57ee5
@ -327,6 +327,8 @@ static int testMessagePayloadDecode(const void *args ATTRIBUTE_UNUSED)
|
||||
};
|
||||
int ret = -1;
|
||||
|
||||
memset(&err, 0, sizeof(err));
|
||||
|
||||
if (!msg)
|
||||
return -1;
|
||||
|
||||
@ -334,7 +336,6 @@ static int testMessagePayloadDecode(const void *args ATTRIBUTE_UNUSED)
|
||||
if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0)
|
||||
goto cleanup;
|
||||
memcpy(msg->buffer, input_buffer, msg->bufferLength);
|
||||
memset(&err, 0, sizeof(err));
|
||||
|
||||
if (virNetMessageDecodeLength(msg) < 0) {
|
||||
VIR_DEBUG("Failed to decode message header");
|
||||
|
Loading…
Reference in New Issue
Block a user