aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2017-07-30 23:36:33 +0200
committerMarcoFalke <falke.marco@gmail.com>2017-10-03 18:19:35 +0200
commit50bd3f626d7ce35d52543b88a2e512074f9df134 (patch)
tree0d72d3ba11f107b39578ddc48c42e3b47800c0e2 /src
parent9e8aae31c103e1d76365c34ce1fe1dd68e93912b (diff)
downloadbitcoin-50bd3f626d7ce35d52543b88a2e512074f9df134.tar.xz
Avoid returning a BIP9Stats object with uninitialized values
Uninitialized data potentially used in `rpc/blockchain.cpp`: ``` static UniValue BIP9SoftForkDesc(const Consensus::Params& consensusParams, Consensus::DeploymentPos id) { ... const ThresholdState thresholdState = VersionBitsTipState(consensusParams, id); ... if (THRESHOLD_STARTED == thresholdState) { UniValue statsUV(UniValue::VOBJ); BIP9Stats statsStruct = VersionBitsTipStatistics(consensusParams, id); statsUV.push_back(Pair("period", statsStruct.period)); statsUV.push_back(Pair("threshold", statsStruct.threshold)); statsUV.push_back(Pair("elapsed", statsStruct.elapsed)); statsUV.push_back(Pair("count", statsStruct.count)); statsUV.push_back(Pair("possible", statsStruct.possible)); rv.push_back(Pair("statistics", statsUV)); } ... return rv; } ``` Github-Pull: #10957 Rebased-From: 3eb53b867153c957529484b5338d27e69de027c1
Diffstat (limited to 'src')
-rw-r--r--src/versionbits.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/versionbits.cpp b/src/versionbits.cpp
index 04a692d826..59588023ad 100644
--- a/src/versionbits.cpp
+++ b/src/versionbits.cpp
@@ -107,7 +107,7 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex*
// return the numerical statistics of blocks signalling the specified BIP9 condition in this current period
BIP9Stats AbstractThresholdConditionChecker::GetStateStatisticsFor(const CBlockIndex* pindex, const Consensus::Params& params) const
{
- BIP9Stats stats;
+ BIP9Stats stats = {};
stats.period = Period(params);
stats.threshold = Threshold(params);