diff options
Diffstat (limited to 'netwerk/base/nsBaseChannel.cpp')
-rw-r--r-- | netwerk/base/nsBaseChannel.cpp | 6 |
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; } |