Closed Bug 353777 Opened 18 years ago Closed 18 years ago

Klocwork Null ptr dereferences in pk11obj.c

Categories

(NSS :: Libraries, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nelson, Assigned: alvolkov.bgs)

Details

(Keywords: klocwork)

Attachments

(1 file)

ID:       88588
Function: PK11_FindGenericObjects
Location: nss/lib/pk11wrap/pk11obj.c

Function: PK11_FindGenericObjects
Location: nss/lib/pk11wrap/pk11obj.c : 1190

Null pointer 'firstObj' that comes from line 1175 may be dereferenced by 
passing argument 1 to function 'PK11_DestroyGenericObjects' at line 1190.

1175	    PK11GenericObject *firstObj = NULL; 
1187	    for (i=0; i < count; i++) { 
1188		obj = PORT_New(PK11GenericObject); 
1189		if ( !obj ) { 
1190		    PK11_DestroyGenericObjects(firstObj); 

ID:       88569
Function: PK11_DestroyGenericObjects
Location: nss/lib/pk11wrap/pk11obj.c : 1292

Dereference of pointer 'objects' at line 1292 before NULL check at line 1294

1288	SECStatus  
1289	PK11_DestroyGenericObjects(PK11GenericObject *objects) 
1290	{ 
1291	    PK11GenericObject *nextObject; 
1292	    PK11GenericObject *prevObject = objects->prev; 
1293	  
1294	    if (objects == NULL) { 
1295		return SECSuccess; 
1296	    }
Attached patch fixSplinter Review
Assignee: nobody → alexei.volkov.bugs
Status: NEW → ASSIGNED
Attachment #241190 - Flags: review?(nelson)
Comment on attachment 241190 [details] [diff] [review]
fix

r=nelson for trunk
Attachment #241190 - Flags: review?(nelson) → review+
Priority: -- → P2
Target Milestone: --- → 3.12
/cvsroot/mozilla/security/nss/lib/pk11wrap/pk11obj.c,v  <--  pk11obj.c
new revision: 1.14; previous revision: 1.13
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: