aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-07-31 20:47:34 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-07-31 20:47:40 +0200
commit7d3623794a106ee119a825608fa110ce8b0cb8fb (patch)
treecb146f07733cfe95339d1222dea317ae438cd9c9
parent230652cafc51a087b25a5e6fbc0114e63b3be0aa (diff)
parent2fb0066b9932f3725a5a0533530453c6da4010ce (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.cpp3
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;
}