mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
linux-user: allow NULL msg in recvfrom
The kernel allows a NULL msg in recvfrom so that he size of the next message may be queried before allocating a correctly sized buffer. This change allows the syscall translator to pass along the NULL msg pointer instead of returning early with EFAULT. Signed-off-by: Zach Reizner <zachr@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <CAFNex=DvFCq=AQf+=19fTfw-T8eZZT=3NnFFm2JMFvVr5QgQyA@mail.gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
23fff7a17f
commit
4a1e6bce23
1 changed files with 8 additions and 3 deletions
|
@ -3679,9 +3679,14 @@ static abi_long do_recvfrom(int fd, abi_ulong msg, size_t len, int flags,
|
||||||
void *host_msg;
|
void *host_msg;
|
||||||
abi_long ret;
|
abi_long ret;
|
||||||
|
|
||||||
|
if (!msg) {
|
||||||
|
host_msg = NULL;
|
||||||
|
} else {
|
||||||
host_msg = lock_user(VERIFY_WRITE, msg, len, 0);
|
host_msg = lock_user(VERIFY_WRITE, msg, len, 0);
|
||||||
if (!host_msg)
|
if (!host_msg) {
|
||||||
return -TARGET_EFAULT;
|
return -TARGET_EFAULT;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (target_addr) {
|
if (target_addr) {
|
||||||
if (get_user_u32(addrlen, target_addrlen)) {
|
if (get_user_u32(addrlen, target_addrlen)) {
|
||||||
ret = -TARGET_EFAULT;
|
ret = -TARGET_EFAULT;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue