From 30b1b057732d657f9fc67ebe22b7a3a9e1e80a6c 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 01203189a..00ffa7662 100644 --- a/iiod/responder.c +++ b/iiod/responder.c @@ -768,6 +768,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);