[vlc-commits] Use WSARecv instead of WSARecvFrom when the from field is empty
Denis Charmet
git at videolan.org
Wed Sep 7 19:42:05 CEST 2016
vlc | branch: master | Denis Charmet <typx at videolan.org> | Wed Sep 7 19:08:35 2016 +0200| [0ca74870c42016492b9d548584f7ba2cd9a60f68] | committer: Denis Charmet
Use WSARecv instead of WSARecvFrom when the from field is empty
Windows will throw WSAEFAULT if WSARecvFrom is called with a NULL lpFrom and/or fromlen
Close #17163
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0ca74870c42016492b9d548584f7ba2cd9a60f68
---
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)
More information about the vlc-commits
mailing list