diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-07-31 20:47:34 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-07-31 20:47:40 +0200 |
commit | 7d3623794a106ee119a825608fa110ce8b0cb8fb (patch) | |
tree | cb146f07733cfe95339d1222dea317ae438cd9c9 | |
parent | 230652cafc51a087b25a5e6fbc0114e63b3be0aa (diff) | |
parent | 2fb0066b9932f3725a5a0533530453c6da4010ce (diff) |
Merge #13776: net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...)
2fb0066b9932f3725a5a0533530453c6da4010ce net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...) (practicalswift)
Pull request description:
Add missing verification of IPv6 address in `CNetAddr::GetIn6Addr(...)`.
Tree-SHA512: 8b0681252eec9cf293a2043e99fdacec520e321b477d8aca1cbd6327b85bf6c5e8cd820fb914f097c62655947e88745ebccd824a78b995a8186e910e6fe520aa
-rw-r--r-- | src/netaddress.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp index 5ccbabd03d..193582d14e 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -300,6 +300,9 @@ bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const { + if (!IsIPv6()) { + return false; + } memcpy(pipv6Addr, ip, 16); return true; } |