Skip to content
Snippets Groups Projects
Commit 79dfc9d5 authored by wtc@chromium.org's avatar wtc@chromium.org
Browse files

Reland r64622 -

Ensure that CertStore::StoreCert never returns a cert_id of 0.

Original review URL: http://codereview.chromium.org/4181006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64816 0039d316-1c4b-4281-b951-d872f2087c98
parent b92a96e8
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,10 @@ int CertStore::StoreCert(net::X509Certificate* cert, int process_id) {
ReverseCertMap::iterator cert_iter = cert_to_id_.find(cert);
if (cert_iter == cert_to_id_.end()) {
cert_id = next_cert_id_++;
// We use 0 as an invalid cert_id value. In the unlikely event that
// next_cert_id_ wraps around, we reset it to 1.
if (next_cert_id_ == 0)
next_cert_id_ = 1;
cert->AddRef();
id_to_cert_[cert_id] = cert;
cert_to_id_[cert] = cert_id;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment