mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 17:30:27 +00:00
Fixed wrong check on size of sockaddr_in passed in the message, causing the function to return EINVAL on BSD/MacOS for non-connected sockets
This commit is contained in:
parent
7a25049ba9
commit
dccbb44d25
1 changed files with 1 additions and 1 deletions
|
@ -43,7 +43,7 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) {
|
||||||
/* An optional address is provided, convert it to the BSD form */
|
/* An optional address is provided, convert it to the BSD form */
|
||||||
char addr2[128];
|
char addr2[128];
|
||||||
struct msghdr msg2;
|
struct msghdr msg2;
|
||||||
if (sizeof(addr2) > msg->msg_namelen) return einval();
|
if (msg->msg_namelen > sizeof(addr2)) return einval();
|
||||||
memcpy(&addr2[0], msg->msg_name, msg->msg_namelen);
|
memcpy(&addr2[0], msg->msg_name, msg->msg_namelen);
|
||||||
sockaddr2bsd(&addr2[0]);
|
sockaddr2bsd(&addr2[0]);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue