saddr should be addrlen bytes
Not sizeof saddr.
@@ -402,7 +402,7 @@ addrretry:
if (c->saddr) {
free(c->saddr);
}
- c->saddr = malloc(sizeof(*p->ai_addr));
+ c->saddr = malloc(p->ai_addrlen);
memcpy(c->saddr, p->ai_addr, p->ai_addrlen);
c->addrlen = p->ai_addrlen;
