From 26957d95fb39d246e39ddbef967f99bfe2ee1f07 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 18 Jan 2023 17:20:26 +0000 Subject: [PATCH] iiod: Refuse to enqueue blocks of size 0 Older development versions of Libiio v1.x will try to enqueue blocks of size 0, which is not supported anymore by the current Libiio and IIOD. Signed-off-by: Paul Cercueil --- iiod/responder.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/iiod/responder.c b/iiod/responder.c index caddb927d..3f9cde1b4 100644 --- a/iiod/responder.c +++ b/iiod/responder.c @@ -767,6 +767,12 @@ static void handle_transfer_block(struct parser_pdata *pdata, if (ret < 0) goto out_send_response; + if (bytes_used == 0) { + IIO_ERROR("Cannot enqueue a block with size 0\n"); + ret = -EINVAL; + goto out_send_response; + } + /* Read the data into the block if we are dealing with a TX buffer */ if (iio_buffer_is_tx(buf)) { readbuf.ptr = iio_block_start(block);