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

This commit is contained in:
Landry Breuil 2015-04-14 22:19:18 +02:00
Родитель 704119af1f
Коммит c755113bc5
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -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;
}