mirror of
https://github.com/qemu/qemu.git
synced 2025-08-10 21:34:57 +00:00
nbd: fix use of two uninitialized bytes when connecting to a named export
Reported-by: Michal Privoznik <mprivoznik@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c8969eded2
commit
8ffaaba0e9
2
nbd.c
2
nbd.c
@ -397,6 +397,7 @@ static int nbd_send_negotiate(NBDClient *client)
|
|||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
|
|
||||||
TRACE("Beginning negotiation.");
|
TRACE("Beginning negotiation.");
|
||||||
|
memset(buf, 0, sizeof(buf));
|
||||||
memcpy(buf, "NBDMAGIC", 8);
|
memcpy(buf, "NBDMAGIC", 8);
|
||||||
if (client->exp) {
|
if (client->exp) {
|
||||||
assert ((client->exp->nbdflags & ~65535) == 0);
|
assert ((client->exp->nbdflags & ~65535) == 0);
|
||||||
@ -406,7 +407,6 @@ static int nbd_send_negotiate(NBDClient *client)
|
|||||||
} else {
|
} else {
|
||||||
cpu_to_be64w((uint64_t*)(buf + 8), NBD_OPTS_MAGIC);
|
cpu_to_be64w((uint64_t*)(buf + 8), NBD_OPTS_MAGIC);
|
||||||
}
|
}
|
||||||
memset(buf + 28, 0, 124);
|
|
||||||
|
|
||||||
if (client->exp) {
|
if (client->exp) {
|
||||||
if (write_sync(csock, buf, sizeof(buf)) != sizeof(buf)) {
|
if (write_sync(csock, buf, sizeof(buf)) != sizeof(buf)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user