[tor-commits] [tor-browser] 20/43: Bug 1765049 - Filter out illegal paths. r=Gijs, a=RyanVM

gitolite role git at cupani.torproject.org
Tue May 31 07:07:03 UTC 2022


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 at 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;
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list