Last Comment Bug 353888 - klockwork IDs for ssl3con.c
: klockwork IDs for ssl3con.c
: klocwork
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: trunk
: All All
P2 normal (vote)
: 3.12
Assigned To: Alexei Volkov
: 339911 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2006-09-22 16:08 PDT by Nelson Bolyard (seldom reads bugmail)
Modified: 2006-10-14 13:26 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

fix as suggested (1.85 KB, patch)
2006-10-03 16:13 PDT, Alexei Volkov
nelson: review+
Details | Diff | Splinter Review

Description User image Nelson Bolyard (seldom reads bugmail) 2006-09-22 16:08:14 PDT
ID:       93124
Function: ssl3_ComputeRecordMAC
Location: nss/lib/ssl/ssl3con.c : 1695

'pad_bytes' might be used uninitialized in this function.

1654		unsigned int       pad_bytes; 

1669		case ssl_hmac_md5: /* used with TLS */ 
1670		    hashObj = HASH_GetRawHashObject(HASH_AlgMD5); 
1671		    break; 

1684		if (!isTLS) { 

1695		    hashObj->update(write_mac_context, mac_pad_1, pad_bytes); 

This is a false positive, since ssl_hmac_md5 is only used with TLS, so 
the code cannot take the !isTLS path after using case ssl_hmac_md5.
But we could easily silence this complaint by initializing pad_bytes to 0.


ID 93125, 93126 and 93127
Function: getWrappingKey

At line 4038, Klocwork thinks that Ks, pubWrapKey and privWrapKey are 
all uninitialized at lines 4038-4040.  pubWrapKey and PrivWrapKep are 
initialized with zero at their declarations at lines 3946-3947.  
I have marked those two IDs as "not a problem", but want to record them 
here, along with the real issue, which is Ks.

3945	    PK11SymKey *      Ks; 
3946	    SECKEYPublicKey   *pubWrapKey = NULL; 
3947	    SECKEYPrivateKey  *privWrapKey = NULL; 
4038		if (privWrapKey) SECKEY_DestroyPrivateKey(privWrapKey); 
4039		if (pubWrapKey) SECKEY_DestroyPublicKey(pubWrapKey); 
4040		if (Ks) PK11_FreeSymKey(Ks);
Comment 1 User image Alexei Volkov 2006-10-03 16:13:04 PDT
Created attachment 241124 [details] [diff] [review]
fix as suggested
Comment 2 User image Nelson Bolyard (seldom reads bugmail) 2006-10-03 16:59:19 PDT
Comment on attachment 241124 [details] [diff] [review]
fix as suggested

Comment 3 User image Alexei Volkov 2006-10-09 15:27:02 PDT
/cvsroot/mozilla/security/nss/lib/ssl/ssl3con.c,v  <--  ssl3con.c
new revision: 1.98; previous revision: 1.97
Comment 4 User image Nelson Bolyard (seldom reads bugmail) 2006-10-14 13:26:26 PDT
*** Bug 339911 has been marked as a duplicate of this bug. ***

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