Bug 1470030 - follow-up fixing covertiy null-deref issue, r=keeler

Summary: Coverity found this issue. We shouldn't continue if n is null because CERT_LIST_NEXT dereferences n.

Differential Revision: https://phabricator.services.mozilla.com/D1876

--HG--
extra : rebase_source : 8023a38425194099f334c6624ce2bd5f2e50cb95
extra : amend_source : 27947d33f9dbb0afa9ae5927dde874957eb4017c
This commit is contained in:
Franziskus Kiefer 2018-07-02 10:39:19 +02:00
Родитель f203ce21fe
Коммит b3c2f7b624
1 изменённых файлов: 7 добавлений и 2 удалений

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

@ -861,9 +861,14 @@ nsNSSComponent::TrustLoaded3rdPartyRoots()
if (mEnterpriseRoots) {
for (CERTCertListNode* n = CERT_LIST_HEAD(mEnterpriseRoots.get());
!CERT_LIST_END(n, mEnterpriseRoots.get()); n = CERT_LIST_NEXT(n)) {
if (!n || !n->cert) {
if (!n) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("library failure: CERTCertListNode null or lacks cert"));
("library failure: CERTCertListNode null"));
break;
}
if (!n->cert) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("library failure: CERTCertListNode lacks cert"));
continue;
}
UniqueCERTCertificate cert(CERT_DupCertificate(n->cert));