summaryrefslogtreecommitdiffstats
path: root/netwerk/base
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 /netwerk/base
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 'netwerk/base')
-rw-r--r--netwerk/base/nsBaseChannel.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/netwerk/base/nsBaseChannel.cpp b/netwerk/base/nsBaseChannel.cpp
index 2575fac04..51caa546e 100644
--- a/netwerk/base/nsBaseChannel.cpp
+++ b/netwerk/base/nsBaseChannel.cpp
@@ -579,6 +579,12 @@ NS_IMETHODIMP
nsBaseChannel::SetContentDispositionFilename(const nsAString &aContentDispositionFilename)
{
mContentDispositionFilename = new nsString(aContentDispositionFilename);
+
+ // For safety reasons ensure the filename doesn't contain null characters and
+ // replace them with underscores. We may later pass the extension to system
+ // MIME APIs that expect null terminated strings.
+ mContentDispositionFilename->ReplaceChar(char16_t(0), '_');
+
return NS_OK;
}