[vlc-devel] [PATCH] Use WSARecv instead of WSARecvFrom when the from field is empty
Jean-Baptiste Kempf
jb at videolan.org
Wed Sep 7 19:32:01 CEST 2016
ACK
On 07 Sep, Denis Charmet wrote :
> Windows will throw WSAEFAULT if WSARecvFrom is called with a NULL lpFrom and/or fromlen
>
> Close #17163
> ---
> compat/recvmsg.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/compat/recvmsg.c b/compat/recvmsg.c
> index 5cb56f7..c90900f 100644
> --- a/compat/recvmsg.c
> +++ b/compat/recvmsg.c
> @@ -54,8 +54,13 @@ ssize_t recvmsg(int fd, struct msghdr *msg, int flags)
> DWORD dwFlags = flags;
> INT fromlen = msg->msg_namelen;
> DWORD rcvd;
> - int ret = WSARecvFrom(fd, buf, msg->msg_iovlen, &rcvd, &dwFlags,
> + int ret;
> + if (fromlen)
> + ret = WSARecvFrom(fd, buf, msg->msg_iovlen, &rcvd, &dwFlags,
> msg->msg_name, &fromlen, NULL, NULL);
> + else
> + ret = WSARecv(fd, buf, msg->msg_iovlen, &rcvd, &dwFlags,
> + NULL, NULL);
> free(buf);
>
> if (ret == 0)
> --
> 2.8.0.rc3
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the vlc-devel
mailing list