]> git.ipfire.org Git - thirdparty/qemu.git/commit
linux-user: permit sendto() with NULL buf and 0 len
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 28 Oct 2025 14:20:01 +0000 (14:20 +0000)
committerRichard Henderson <richard.henderson@linaro.org>
Fri, 31 Oct 2025 11:50:15 +0000 (12:50 +0100)
commit0db2de22fcbf90adafab9d9dd1fc8203c66bfa75
treedc2ae70c07fd7a4af51ec3c11dc2ba80bae79556
parent34117f03edb53e37108845060c34af3aad8d0c43
linux-user: permit sendto() with NULL buf and 0 len

If you pass sendto() a NULL buffer, this is usually an error
(causing an EFAULT return); however if you pass a 0 length then
we should not try to validate the buffer provided. Instead we
skip the copying of the user data and possible processing
through fd_trans_target_to_host_data, and call the host syscall
with NULL, 0.

(unlock_user() permits a NULL buffer pointer for "do nothing"
so we don't need to special case the unlock code.)

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3102
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20251028142001.3011630-1-peter.maydell@linaro.org>
linux-user/syscall.c