Open Bug 2089976 Opened 17 days ago

Zero-initialize the SECItem requests in SecretDecoderRing.cpp

Categories

(Core :: Security: PSM, task)

task

Tracking

()

People

(Reporter: Sylvestre, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++])

Filing as a good first bug to learn workflows.

SECItem request; leaves the type field uninitialized (only data and len are set) in both Encrypt and Decrypt. NSS does not read it today, but brace-initialize it (SECItem request = {siBuffer, nullptr, 0};) so the struct is fully defined.

Current code:

  keyid.len = 0;
  SECItem request;
  request.data = BitwiseCast<unsigned char*, const char*>(data.BeginReading());

Link to the code:
https://searchfox.org/firefox-main/source/security/manager/ssl/SecretDecoderRing.cpp

To verify the fix:

./mach build
./mach xpcshell-test security/manager/ssl/tests/unit/test_sdr.js

This was reported by Coverity Scan (CID 1512906). The analyzer will stop reporting it once the change lands.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

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