Skip to content

Commit

Permalink
iiod: Refuse to enqueue blocks of size 0
Browse files Browse the repository at this point in the history
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 <paul@crapouillou.net>
  • Loading branch information
pcercuei committed Oct 5, 2023
1 parent ffde142 commit 5085ee3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions iiod/responder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5085ee3

Please sign in to comment.