Closed Bug 2089983 Opened 16 days ago Closed 5 days ago

Handle a missing type value in the updater manifest parser

Categories

(Toolkit :: Application Update, task)

task

Tracking

()

RESOLVED FIXED
162 Branch
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.

Severity: -- → N/A

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.

Assignee: nobody → melchior.vila
Status: NEW → ASSIGNED
Pushed by spohl@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/d4c12ab211e4 https://hg.mozilla.org/integration/autoland/rev/07d4c50efc35 Handle a missing type value in the updater manifest parser. r=application-update-reviewers,spohl
Status: ASSIGNED → RESOLVED
Closed: 5 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: