summaryrefslogtreecommitdiffstats
path: root/uriloader/exthandler/nsExternalHelperAppService.cpp
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-07-29 01:21:13 +0000
committerMoonchild <moonchild@palemoon.org>2020-07-29 14:28:24 +0000
commita91722be27ce3bd541ca10155fe80d81202785ad (patch)
treeb41bffb348ab3d81cd4a622dedbb575f9780c019 /uriloader/exthandler/nsExternalHelperAppService.cpp
parent1ef64f9ea3396f29b996da0293f96030bd4ac2a5 (diff)
downloadUXP-a91722be27ce3bd541ca10155fe80d81202785ad.tar
UXP-a91722be27ce3bd541ca10155fe80d81202785ad.tar.gz
UXP-a91722be27ce3bd541ca10155fe80d81202785ad.tar.lz
UXP-a91722be27ce3bd541ca10155fe80d81202785ad.tar.xz
UXP-a91722be27ce3bd541ca10155fe80d81202785ad.zip
[network/dom] Improve sanitization of download filenames.
Diffstat (limited to 'uriloader/exthandler/nsExternalHelperAppService.cpp')
-rw-r--r--uriloader/exthandler/nsExternalHelperAppService.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
index 49a54ea5f..0ca3d7edf 100644
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -1181,9 +1181,12 @@ nsExternalAppHandler::nsExternalAppHandler(nsIMIMEInfo * aMIMEInfo,
mTempFileExtension = char16_t('.');
AppendUTF8toUTF16(aTempFileExtension, mTempFileExtension);
- // replace platform specific path separator and illegal characters to avoid any confusion
- mSuggestedFileName.ReplaceChar(KNOWN_PATH_SEPARATORS FILE_ILLEGAL_CHARACTERS, '_');
- mTempFileExtension.ReplaceChar(KNOWN_PATH_SEPARATORS FILE_ILLEGAL_CHARACTERS, '_');
+ // Replace platform specific path separator and illegal characters to avoid any confusion
+ mSuggestedFileName.ReplaceChar(KNOWN_PATH_SEPARATORS, '_');
+ mSuggestedFileName.ReplaceChar(FILE_ILLEGAL_CHARACTERS, ' ');
+ mSuggestedFileName.ReplaceChar(char16_t(0), '_');
+ mTempFileExtension.ReplaceChar(KNOWN_PATH_SEPARATORS, '_');
+ mTempFileExtension.ReplaceChar(FILE_ILLEGAL_CHARACTERS, ' ');
// Remove unsafe bidi characters which might have spoofing implications (bug 511521).
const char16_t unsafeBidiCharacters[] = {