mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-14 17:13:15 -07:00
Fix for getsockname() crash and other address size issues.
This commit is contained in:
parent
efc2a74df1
commit
3137f43da9
3 changed files with 28 additions and 23 deletions
|
@ -1159,14 +1159,12 @@ void NetconEthernetTap::handle_getsockname(PhySocket *sock, void **uptr, struct
|
|||
*/
|
||||
|
||||
// Assemble address "command" to send to intercept
|
||||
char retmsg[sizeof(struct sockaddr)];
|
||||
memset(&retmsg, '\0', sizeof(retmsg));
|
||||
char retmsg[sizeof(struct sockaddr_storage)];
|
||||
memset(&retmsg, 0, sizeof(retmsg));
|
||||
dwr(MSG_ERROR, " handle_getsockname(): %d\n", sizeof(retmsg));
|
||||
if(conn == NULL) return;
|
||||
memcpy(&retmsg, conn->addr, 1);
|
||||
// Get connection's RPC fd and send structure containing bound address
|
||||
int fd = _phy.getDescriptor(conn->rpcSock);
|
||||
write(fd, &retmsg, sizeof(struct sockaddr));
|
||||
if ((conn)&&(conn->addr))
|
||||
memcpy(&retmsg, conn->addr, sizeof(struct sockaddr_in));
|
||||
write(_phy.getDescriptor(conn->rpcSock), &retmsg, sizeof(struct sockaddr_storage));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue