From 5e6bbf8c6075ce6406d424e7ed031c7a6c676fb2 Mon Sep 17 00:00:00 2001 From: Mark Nunberg Date: Mon, 5 Mar 2018 11:57:22 +0200 Subject: [PATCH] saddr should be addrlen bytes Not sizeof saddr. --- net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net.c b/net.c index 62c6ca0..7d5588e 100644 --- a/net.c +++ b/net.c @@ -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;