提交 8ffaaba0 编写于 作者: P Paolo Bonzini

nbd: fix use of two uninitialized bytes when connecting to a named export

Reported-by: NMichal Privoznik <mprivoznik@redhat.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 c8969ede
......@@ -397,6 +397,7 @@ static int nbd_send_negotiate(NBDClient *client)
rc = -EINVAL;
TRACE("Beginning negotiation.");
memset(buf, 0, sizeof(buf));
memcpy(buf, "NBDMAGIC", 8);
if (client->exp) {
assert ((client->exp->nbdflags & ~65535) == 0);
......@@ -406,7 +407,6 @@ static int nbd_send_negotiate(NBDClient *client)
} else {
cpu_to_be64w((uint64_t*)(buf + 8), NBD_OPTS_MAGIC);
}
memset(buf + 28, 0, 124);
if (client->exp) {
if (write_sync(csock, buf, sizeof(buf)) != sizeof(buf)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册