Closed Bug 233019 Opened 21 years ago Closed 21 years ago

CERT_FindCertByKeyID crashes using NULL ptr

Categories

(NSS :: Libraries, defect, P2)

x86
Windows 2000
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nelson, Assigned: nelson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

CERT_FindCertByKeyID is needed to find the CA cert that issued a CRL.
But the present implementation is badly broken.  
It uses a cert pointer that is always NULL.
I have coded and tested a fix.  
Patch forthcoming.
Blocks: 217387
Marking p2 for NSS 3.10.  If desired, this patch can be put in 3.9.1
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → 3.10
Attached patch patch v1Splinter Review
This patch fixes several bugs:
1) it passes the correct pointer (not NULL) to SECITEM_ItemsAreEqual
2) It terminates the loop when it reaches the end of the circular 
   doubly-linked list of cert nodes
3) It frees the cert list before returning.
4) It sets the error code if it fails to find any matching certs.
Comment on attachment 140570 [details] [diff] [review]
patch v1

Julien, Please review.
Attachment #140570 - Flags: review?(jpierre)
Comment on attachment 140570 [details] [diff] [review]
patch v1

Fix looks good.

It would be nice if we cached the certs by keyID in a hash table, rather that
looping over everything to do the lookup, but this would probably belong in
another layer (cert cache, stan?).
Attachment #140570 - Flags: review?(jpierre) → review+
/cvsroot/mozilla/security/nss/lib/certdb/stanpcertdb.c,v  <--  stanpcertdb.c
new revision: 1.63; previous revision: 1.62

Thanks for the review.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: