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 <mlichvar@redhat.com>
master
Miroslav Lichvar 2019-03-25 11:38:13 +01:00 committed by Richard Cochran
parent 86723cfc6a
commit dd30b3a0d9
1 changed files with 2 additions and 2 deletions

4
util.c
View File

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