Handle a missing type value in the updater manifest parser
Categories
(Toolkit :: Application Update, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
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.
const NS_tchar* type = mstrtok(kQuote, &line); can return null for a malformed type line, which is then logged and passed to NS_tstrcmp. Every other mstrtok result in this function is checked and returns PARSE_ERROR; do the same here (if (!type) { free(buf); return PARSE_ERROR; }, matching the surrounding cleanup).
Current code:
if (NS_tstrcmp(token, NS_T("type")) == 0) {
const NS_tchar* type = mstrtok(kQuote, &line);
LOG(("UPDATE TYPE " LOG_S, type));
Link to the code:
https://searchfox.org/firefox-main/source/toolkit/mozapps/update/updater/updater.cpp
To verify the fix:
./mach build
./mach test toolkit/mozapps/update/tests --headless
This was reported by Coverity Scan (CID 749080). 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.
Updated•16 days ago
|
mstrtok() returns null when the type line in update.manifest has no
quoted value, and the null was passed to LOG and NS_tstrcmp. Return
PARSE_ERROR instead, and log it as DoUpdate() already does when the
first token is missing.
Updated•8 days ago
|
Description
•