Merge pull request #6556

1123cdb add unit test for CNetAddr::GetGroup. (Alex Morcos)
bba3db1 Fix masking of irrelevant bits in address groups. (Alex Morcos)
This commit is contained in:
Wladimir J. van der Laan
2015-08-20 16:45:20 +02:00
2 changed files with 18 additions and 1 deletions

View File

@@ -983,7 +983,7 @@ std::vector<unsigned char> CNetAddr::GetGroup() const
nBits -= 8;
}
if (nBits > 0)
vchRet.push_back(GetByte(15 - nStartByte) | ((1 << nBits) - 1));
vchRet.push_back(GetByte(15 - nStartByte) | ((1 << (8 - nBits)) - 1));
return vchRet;
}