mirror of
https://github.com/videolan/vlc.git
synced 2024-12-04 15:26:23 +08:00
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
This commit is contained in:
parent
0716db4d95
commit
0ca74870c4
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user