diff --git a/src/description.cpp b/src/description.cpp index e89fe1237..bd4cd6350 100644 --- a/src/description.cpp +++ b/src/description.cpp @@ -1330,9 +1330,8 @@ std::string CertificateFingerprint::AlgorithmIdentifier( } bool CertificateFingerprint::isValid() const { - auto expectedSize = AlgorithmSize(algorithm); - - if (this->value.size() != expectedSize * 3 - 1) { + size_t expectedSize = AlgorithmSize(this->algorithm); + if (expectedSize == 0 || this->value.size() != expectedSize * 3 - 1) { return false; }