From dd30b3a0d94d1c087066066e5df6bc84e3019b0b Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 25 Mar 2019 11:38:13 +0100 Subject: [PATCH] util: Fix addreq() to not read past addresses. Fix the length of compared data to be the size of the IPv4/IPv6 address. Signed-off-by: Miroslav Lichvar --- util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util.c b/util.c index 9ad23e0..42c0977 100644 --- a/util.c +++ b/util.c @@ -78,12 +78,12 @@ int addreq(enum transport_type type, struct address *a, struct address *b) case TRANS_UDP_IPV4: bufa = &a->sin.sin_addr; bufb = &b->sin.sin_addr; - len = sizeof(a->sin); + len = sizeof(a->sin.sin_addr); break; case TRANS_UDP_IPV6: bufa = &a->sin6.sin6_addr; bufb = &b->sin6.sin6_addr; - len = sizeof(a->sin6); + len = sizeof(a->sin6.sin6_addr); break; case TRANS_IEEE_802_3: bufa = &a->sll.sll_addr;