Bug 1153090 followup - consistently use sizeof(hash) r=dkeeler

This commit is contained in:
Landry Breuil 2015-04-14 22:19:18 +02:00
parent 3029343eeb
commit 13c5620ed7

View File

@ -95,10 +95,12 @@ uint32_t
CertBlocklistItem::Hash() const
{
uint32_t hash;
// there's no requirement for a serial to be as large as 32 bits; if it's
// smaller, fall back to the first octet (otherwise, the last four)
if (mItemMechanism == BlockByIssuerAndSerial && mOtherLength >= 4) {
memcpy(&hash, mOtherData + mOtherLength - 4, sizeof(hash));
// there's no requirement for a serial to be as large as the size of the hash
// key; if it's smaller, fall back to the first octet (otherwise, the last
// four)
if (mItemMechanism == BlockByIssuerAndSerial &&
mOtherLength >= sizeof(hash)) {
memcpy(&hash, mOtherData + mOtherLength - sizeof(hash), sizeof(hash));
} else {
hash = *mOtherData;
}