aboutsummaryrefslogtreecommitdiff
path: root/src/netaddress.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-11-23 09:49:41 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2018-11-23 09:53:20 +0100
commit2479b779aae435d45062cea902dbb7638e14b88f (patch)
tree3d97273c78dbd2a49206daa37638ff8fb1a2b333 /src/netaddress.h
parenta0d86815cda982d06db333fd9290aa82660807cb (diff)
parentb7b36decaf878a8c1dcfdb4a27196c730043474b (diff)
downloadbitcoin-2479b779aae435d45062cea902dbb7638e14b88f.tar.xz
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.h')
-rw-r--r--src/netaddress.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/netaddress.h b/src/netaddress.h
index 86c13b3465..ca435d17dc 100644
--- a/src/netaddress.h
+++ b/src/netaddress.h
@@ -33,7 +33,7 @@ class CNetAddr
{
protected:
unsigned char ip[16]; // in network byte order
- uint32_t scopeId; // for scoped/link-local ipv6 addresses
+ uint32_t scopeId{0}; // for scoped/link-local ipv6 addresses
public:
CNetAddr();