diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-11-23 09:49:41 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-11-23 09:53:20 +0100 |
commit | 2479b779aae435d45062cea902dbb7638e14b88f (patch) | |
tree | 3d97273c78dbd2a49206daa37638ff8fb1a2b333 /src/netaddress.cpp | |
parent | a0d86815cda982d06db333fd9290aa82660807cb (diff) | |
parent | b7b36decaf878a8c1dcfdb4a27196c730043474b (diff) |
Merge #14728: fix uninitialized read when stringifying an addrLocal
b7b36decaf878a8c1dcfdb4a27196c730043474b fix uninitialized read when stringifying an addrLocal (Kaz Wesley)
8ebbef016928811756e46b9086067d1c826797a8 add test demonstrating addrLocal UB (Kaz Wesley)
Pull request description:
Reachable from either place where SetIP is used when all of:
- our best-guess addrLocal for a peer is IPv4
- the peer tells us it's reaching us at an IPv6 address
- NET logging is enabled
In that case, SetIP turns an IPv4 address into an IPv6 address without
setting the scopeId, which is subsequently read in GetSockAddr during
CNetAddr::ToStringIP and passed to getnameinfo. Fix by ensuring every
constructor initializes the scopeId field with something.
Tree-SHA512: 8f0159750995e08b985335ccf60a273ebd09003990bcf2c3838b550ed8dc2659552ac7611650e6dd8e29d786fe52ed57674f5880f2e18dc594a7a863134739e3
Diffstat (limited to 'src/netaddress.cpp')
-rw-r--r-- | src/netaddress.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp index 72be77dfd9..a0c7f8e3c2 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -17,7 +17,6 @@ static const unsigned char g_internal_prefix[] = { 0xFD, 0x6B, 0x88, 0xC0, 0x87, CNetAddr::CNetAddr() { memset(ip, 0, sizeof(ip)); - scopeId = 0; } void CNetAddr::SetIP(const CNetAddr& ipIn) |