qemu-e2k/nbd
Eric Blake 70fa99f445 nbd/client: Add safety check on chunk payload length
Our existing use of structured replies either reads into a qiov capped
at 32M (NBD_CMD_READ) or caps allocation to 1000 bytes (see
NBD_MAX_MALLOC_PAYLOAD in block/nbd.c).  But the existing length
checks are rather late; if we encounter a buggy (or malicious) server
that sends a super-large payload length, we should drop the connection
right then rather than assuming the layer on top will be careful.
This becomes more important when we permit 64-bit lengths which are
even more likely to have the potential for attempted denial of service
abuse.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-ID: <20230608135653.2918540-8-eblake@redhat.com>
2023-07-19 15:26:13 -05:00
..
client-connection.c bulk: Remove pointless QOM casts 2023-06-05 20:48:34 +02:00
client.c nbd/client: Add safety check on chunk payload length 2023-07-19 15:26:13 -05:00
common.c nbd: Prepare for NBD_CMD_FLAG_FAST_ZERO 2019-09-05 16:03:13 -05:00
meson.build nbd: move connection code from block/nbd to nbd/client-connection 2021-06-18 10:59:53 -05:00
nbd-internal.h coroutine: Clean up superfluous inclusion of qemu/coroutine.h 2023-01-19 10:18:28 +01:00
server.c nbd: s/handle/cookie/ to match NBD spec 2023-07-19 15:25:30 -05:00
trace-events nbd: s/handle/cookie/ to match NBD spec 2023-07-19 15:25:30 -05:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00