This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-91.10.0esr-11.0-1 in repository tor-browser.
commit c0d1190dd9a47b5c9de068e4b632e17e4525ad1b Author: Molly Howell mhowell@mozilla.com AuthorDate: Mon May 9 19:27:08 2022 +0000
Bug 1765049 - Filter out illegal paths. r=Gijs, a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D145518 --- widget/windows/nsFilePicker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp index e288700f7f15a..f17a759e1aa07 100644 --- a/widget/windows/nsFilePicker.cpp +++ b/widget/windows/nsFilePicker.cpp @@ -253,7 +253,12 @@ bool nsFilePicker::ShowFilePicker(const nsString& aInitialDir) {
// default filename if (!mDefaultFilename.IsEmpty()) { - hr = dialog->SetFileName(mDefaultFilename.get()); + // Prevent the shell from expanding environment variables by removing + // the % characters that are used to delimit them. + nsAutoString sanitizedFilename(mDefaultFilename); + sanitizedFilename.ReplaceChar('%', '_'); + + hr = dialog->SetFileName(sanitizedFilename.get()); if (FAILED(hr)) { return false; }