saddr should be addrlen bytes

Not sizeof saddr.
This commit is contained in:
Mark Nunberg 2018-03-05 11:57:22 +02:00
parent 49974c9359
commit 5e6bbf8c60

2
net.c
View File

@ -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;