]> git.ipfire.org Git - thirdparty/libvirt.git/commit
src: cap the data size in stream I/O functions
authorDaniel P. Berrangé <berrange@redhat.com>
Mon, 24 Nov 2025 11:17:22 +0000 (11:17 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Mon, 24 Nov 2025 12:16:56 +0000 (12:16 +0000)
commite9f74bbdba08ee85e0ec98d5e7c783a40cec1904
tree13f58f8857a4ba097eaab3b9894dea26556d415d
parent2e595888aac80f5b10cd5e509a34e4cef016f3a1
src: cap the data size in stream I/O functions

The main stream I/O functions have a design flaw in that they accept
'size_t' as the input data length, while intending to return the
amount actually processed in an 'int'.

Fortunately all functions explicitly document that less data may be
processed than requested, and with the remote driver data cap we will
never get anywhere near exceeding an 'int' even on 32-bit.

For sanity, however, lets explicitly cap the data size in the public
API to fix the design flaw.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/libvirt-stream.c