Closed Bug 353773 Opened 18 years ago Closed 18 years ago

klocwork Null ptr dereferences in pk11nobj.c

Categories

(NSS :: Libraries, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nelson, Assigned: alvolkov.bgs)

Details

(Keywords: klocwork)

Attachments

(1 file, 1 obsolete file)

ID:       92202
Function: SEC_DeletePermCRL
Location: nss/lib/pk11wrap/pk11nobj.c : 550

Pointer 'object' returned from call to function 'nss_ZAlloc' at line 549 
may be NULL and will be dereferenced at line 550.

549	    object = nss_ZNEW(NULL, nssCryptokiObject); 
550	    object->token = nssToken_AddRef(token); 
551	    object->handle = crl->pkcs11ID; 
552	    object->isTokenObject = PR_TRUE; 

----

ID:       88551
Function: PK11_FindSMimeProfile
Location: nss/lib/pk11wrap/pk11nobj.c : 602

Pointer 'list' returned from call to function 'PK11_GetAllTokens' at 
line 597 may be NULL and will be dereferenced at line 602.

597		PK11SlotList *list = PK11_GetAllTokens(CKM_INVALID_MECHANISM, 
598						PR_FALSE,PR_TRUE,NULL); 
599		PK11SlotListElement *le; 
602		for (le = list->head; le; le = le->next) {
Attached patch fixes (obsolete) — Splinter Review
Assignee: nobody → alexei.volkov.bugs
Status: NEW → ASSIGNED
Attachment #241192 - Flags: review?(nelson)
Priority: -- → P2
Target Milestone: --- → 3.12
Comment on attachment 241192 [details] [diff] [review]
fixes

If PK11_GetAllTokens returns NULL, that is a fatal error in itself. 
In that case, we should return NULL right away, without setting a
diffrent error code, such as SEC_ERROR_NO_KRL.
Attachment #241192 - Flags: review?(nelson) → review-
Attachment #241192 - Attachment is obsolete: true
Attachment #241202 - Flags: review?(nelson)
Comment on attachment 241202 [details] [diff] [review]
do not change error code returned by PK11_GetAllTokens

r=nelson for trunk
Attachment #241202 - Flags: review?(nelson) → review+
/cvsroot/mozilla/security/nss/lib/pk11wrap/pk11nobj.c,v  <--  pk11nobj.c
new revision: 1.8; previous revision: 1.7
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: