Closed Bug 1607652 Opened 5 years ago Closed 5 years ago

Firefox won't delete key3.db if the profile path contains non-ASCII string on Windows

Categories

(Core :: Security: PSM, defect)

Unspecified
Windows
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: emk, Assigned: emk)

References

Details

Attachments

(1 file)

GetNSSProfilePath will make a UTF-8 file path on Windows:
https://searchfox.org/mozilla-central/rev/a92ed79b0bc746159fc31af1586adbfa9e45e264/security/manager/ssl/nsNSSComponent.cpp#1413-1425

But MaybeCleanUpOldNSSFiles > GetFileIfExists passes the string to InitWithNativePath that expects ANSI encoded file paths:
https://searchfox.org/mozilla-central/rev/a92ed79b0bc746159fc31af1586adbfa9e45e264/security/manager/ssl/nsNSSComponent.cpp#1545

GetFileIfExists should convert the profile path to UTF-16 and use InitWithPath.

See also bug 1607542. Not sure if mozilla-central still needs this fix.

Should this be fixed on esr68 ?

(In reply to Masatoshi Kimura [:emk] from comment #0)

GetFileIfExists should convert the profile path to UTF-16

How?

Flags: needinfo?(VYV03354)
See Also: → CVE-2020-6794

Something like:

#ifdef XP_WIN
  // |path| is encoded in UTF-8 because SQLite always takes UTF-8 file paths
  // regardless of the current system code page.
  nsresult rv = file->InitWithPath(NS_ConvertUTF8toUTF16(path));
#else
  nsresult rv = file->InitWithNativePath(path);
#endif
Flags: needinfo?(VYV03354)
Assignee: nobody → VYV03354
Status: NEW → ASSIGNED
Attachment #9119421 - Attachment description: Bug 1607652 - Handle non-ASCII profile path correctly when deleting key3.db on Windows. r?keeler → Bug 1607652 - Handle non-ASCII profile path correctly when dealing with key3.db and pkcs11.txt on Windows. r?keeler
Pushed by VYV03354@nifty.ne.jp: https://hg.mozilla.org/integration/autoland/rev/f8b5627432c6 Handle non-ASCII profile path correctly when dealing with key3.db and pkcs11.txt on Windows. r=keeler
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: