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
parent
86723cfc6a
commit
dd30b3a0d9
4
util.c
4
util.c
|
@ -78,12 +78,12 @@ int addreq(enum transport_type type, struct address *a, struct address *b)
|
||||||
case TRANS_UDP_IPV4:
|
case TRANS_UDP_IPV4:
|
||||||
bufa = &a->sin.sin_addr;
|
bufa = &a->sin.sin_addr;
|
||||||
bufb = &b->sin.sin_addr;
|
bufb = &b->sin.sin_addr;
|
||||||
len = sizeof(a->sin);
|
len = sizeof(a->sin.sin_addr);
|
||||||
break;
|
break;
|
||||||
case TRANS_UDP_IPV6:
|
case TRANS_UDP_IPV6:
|
||||||
bufa = &a->sin6.sin6_addr;
|
bufa = &a->sin6.sin6_addr;
|
||||||
bufb = &b->sin6.sin6_addr;
|
bufb = &b->sin6.sin6_addr;
|
||||||
len = sizeof(a->sin6);
|
len = sizeof(a->sin6.sin6_addr);
|
||||||
break;
|
break;
|
||||||
case TRANS_IEEE_802_3:
|
case TRANS_IEEE_802_3:
|
||||||
bufa = &a->sll.sll_addr;
|
bufa = &a->sll.sll_addr;
|
||||||
|
|
Loading…
Reference in New Issue