Check the Base64Decode result when building threat entries in nsUrlClassifierUtils.cpp
Categories
(Toolkit :: Safe Browsing, task)
Tracking
()
People
(Reporter: Sylvestre, Assigned: melchior.vila, Mentored)
References
(Blocks 1 open bug)
Details
(Keywords: good-first-bug, Whiteboard: [lang=c++])
Attachments
(1 external file)
Filing as a good first bug to learn workflows.
When setting the threat entries, rv = Base64Decode(prefix, prefixBinary); is not checked, so an invalid prefix would add an empty hash. Add NS_ENSURE_SUCCESS(rv, rv); like the other Base64Decode calls in the file.
Current code:
nsCString prefixBinary;
rv = Base64Decode(prefix, prefixBinary);
threatInfo->add_threat_entries()->set_hash(prefixBinary.get(),
Link to the code:
https://searchfox.org/firefox-main/source/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
To verify the fix:
./mach build
./mach gtest 'UrlClassifier*'
This was reported by Coverity Scan (CID 1447360). 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.
An invalid prefix was added as an empty hash. Adds a regression test.
Updated•1 day ago
|
Description
•