Skip to content

Commit

Permalink
proxy_getaddrinfo: don't use sizeof(struct sockaddr_storage) for addr…
Browse files Browse the repository at this point in the history
…_len

this should fix an issue which seems to be mac's bind() only accepting
sizeof(struct sockaddr_in) for AF_INET.

ref: rofl0r/microsocks#19
  • Loading branch information
rofl0r committed May 25, 2019
1 parent 5ad7c2a commit de4460f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
p->ai_canonname = space->addr_name;
p->ai_next = NULL;
p->ai_family = space->sockaddr_space.ss_family = af;
p->ai_addrlen = sizeof(space->sockaddr_space);
p->ai_addrlen = af == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);

if(hints) {
p->ai_socktype = hints->ai_socktype;
Expand Down

0 comments on commit de4460f

Please sign in to comment.