提交 b32ac57e 编写于 作者: D Daniel P. Berrange

Avoid use of uninitialized data in virnetmessagetest

If an error occurs in virnetmessagetest it was possible it
would free uninitialized data.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 a93eb09a
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册