wireguard: Fix struct sockaddr usage 89/261189/1
authorDaniel Wagner <wagi@monom.org>
Fri, 9 Oct 2020 07:28:00 +0000 (09:28 +0200)
committerNishant Chaprana <n.chaprana@samsung.com>
Tue, 13 Jul 2021 06:20:29 +0000 (11:50 +0530)
commit9c394d387dc4dc546972dcae50a227dc6a9989ae
treebe03bf4b27f8be97f7d6bded9b944faff639b495
parentcce6ed197cf6503e5ff068c2a25ad8f435b12068
wireguard: Fix struct sockaddr usage

wg_dns_reresolve_cb() tries to read 16 bytes from the addr variable in
case of IPv6 but struct sockaddr has size of 8 bytes. Introduce a
helper struct containing IPv4 and IPv6 sockaddr as superset of all IP
based sockaddr.

This helper struct is identically to the 'union endpoint' in
wireguard.h. But we don't want to touch this header file as it is 100%
copy from the upstream WireGuard project.

Fixes: 90592f7a5835 ("wireguard: Regular reresolve endpoint address")
Change-Id: I2b262e61e52c795ab0cab4b206bd25df8ae57738
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
vpn/plugins/wireguard.c