Closed Bug 1117617 Opened 11 years ago Closed 11 years ago

Uninitialized return value in nss_dbm_db_set_label()

Categories

(NSS :: Libraries, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(firefox37 unaffected, firefox38 unaffected)

RESOLVED FIXED
3.17.4
Tracking Status
firefox37 --- unaffected
firefox38 --- unaffected

People

(Reporter: n.nethercote, Assigned: keeler)

References

Details

(Keywords: csectype-uninitialized, sec-other)

Attachments

(1 file)

cppcheck says: > security/nss/lib/ckfw/dbm/db.c:141: error: Uninitialized variable: rv As far as I can tell it's correct -- in the first |return| statement |rv| is undefined. I think it should probably instead be more like nss_dbm_db_delete_object() and return the return value from the failed NSSCKFWMutex_Lock() call. And someone who understands this code should audit all the other uses of NSSCKFWMutex_Lock() in this file... - Some of them look ok -- e.g. on lock failure they return NULL or CK_FALSE, which might be ok. - But nss_dbm_db_new_handle() looks like it doesn't set |*pError| in all the cases it should. - And nss_dbm_db_get_object_attribute_count() returns 0 instead of |*pError| if locking fails -- and 0 is CKR_OK! Likewise with nss_dbm_db_get_object_attribute_size().
Blocks: cppcheck
Component: CA Certificates → Libraries
David, can you take a look at this?
Flags: needinfo?(dkeeler)
Attached patch patchSplinter Review
The other cases looked ok (some of them don't return a CK_RV, and so aren't supposed to be error codes). Wan-Teh, would you mind having a look? Thanks.
Assignee: nobody → dkeeler
Status: NEW → ASSIGNED
Flags: needinfo?(dkeeler)
Attachment #8548379 - Flags: review?(wtc)
David, what is the security severity of this bug?
Flags: needinfo?(dkeeler)
(In reply to Nicholas Nethercote [:njn] from comment #0) > - And nss_dbm_db_get_object_attribute_count() returns 0 instead of |*pError| > if locking fails -- and 0 is CKR_OK! Likewise with > nss_dbm_db_get_object_attribute_size(). Because they don't return status error type CK_RV, they return a numeric result. Returning 0 seems to be the right result code for the count/size functions. The other places that call NSSCKFWMutex_Lock look correct to me, too.
Attachment #8548379 - Flags: review?(wtc) → review+
(In reply to David Bolter [:davidb] from comment #3) > David, what is the security severity of this bug? As far as I can tell, NSSCKFWMutex_Lock never returns anything other than CKR_OK, so this isn't even a security problem with the current code. Still good to fix, though, in case the underlying implementation changes.
Flags: needinfo?(dkeeler)
Keywords: sec-other
Kai, would you mind checking this patch in when appropriate? Thanks.
Flags: needinfo?(kaie)
(In reply to David Keeler [:keeler] (use needinfo?) from comment #6) > As far as I can tell, NSSCKFWMutex_Lock never returns anything other than > CKR_OK, so this isn't even a security problem with the current code. Still > good to fix, though, in case the underlying implementation changes. Does that mean we can open up this bug? (In reply to David Keeler [:keeler] (use needinfo?) from comment #7) > Kai, would you mind checking this patch in when appropriate? Thanks. Sure, I'll do. Once I check it in, it's probably no longer of any value to keep this bug security/hidden anyway.
Flags: needinfo?(kaie)
Keywords: checkin-needed
Yeah, this isn't security-sensitive. Thanks!
Group: core-security
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 3.18
mass change target milestone to 3.17.4
Target Milestone: 3.18 → 3.17.4
Tracking for 37 as well since that is impacted. Kai - do we need a bug for bumping NSS version in FF37 for this and bug 1117621?
Flags: needinfo?(kaie)
keeler - Can you answer Lukas' question in comment 12?
Flags: needinfo?(dkeeler)
Neither this bug nor bug 1117621 impact the security of Firefox (see comment 6 and bug 1117621 comment 5 for why), so it's not necessary to update NSS in FF37 for these bugs. However, there may be other bugs for which we would need to update. Kai would know the answer to that. I'll specifically ask in this week's NSS meeting if he doesn't respond here before then.
Flags: needinfo?(dkeeler)
Clearing 37 tracking and status based on comment 14. If there are others bugs that require an NSS update, please nom those bugs for tracking.
This bug is fixed in NSS 3.17.4, and Firefox 37 already uses NSS 3.17.4
Flags: needinfo?(kaie)
I guess this is the same for 38.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: