Last Comment Bug 353777 - Klocwork Null ptr dereferences in pk11obj.c
: Klocwork Null ptr dereferences in pk11obj.c
Status: RESOLVED FIXED
: klocwork
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: trunk
: All All
: P2 normal (vote)
: 3.12
Assigned To: Alexei Volkov
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-22 00:57 PDT by Nelson Bolyard (seldom reads bugmail)
Modified: 2006-10-09 15:25 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
fix (1.52 KB, patch)
2006-10-04 11:13 PDT, Alexei Volkov
nelson: review+
Details | Diff | Review

Description Nelson Bolyard (seldom reads bugmail) 2006-09-22 00:57:38 PDT
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	    }
Comment 1 Alexei Volkov 2006-10-04 11:13:47 PDT
Created attachment 241190 [details] [diff] [review]
fix
Comment 2 Nelson Bolyard (seldom reads bugmail) 2006-10-04 11:24:41 PDT
Comment on attachment 241190 [details] [diff] [review]
fix

r=nelson for trunk
Comment 3 Alexei Volkov 2006-10-09 15:25:51 PDT
/cvsroot/mozilla/security/nss/lib/pk11wrap/pk11obj.c,v  <--  pk11obj.c
new revision: 1.14; previous revision: 1.13

Note You need to log in before you can comment on or make changes to this bug.