mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
[network/dom] Improve sanitization of download filenames.
This commit is contained in:
parent
b33e80b186
commit
52c03190ee
4 changed files with 26 additions and 3 deletions
|
|
@ -562,6 +562,12 @@ NS_IMETHODIMP
|
|||
HttpBaseChannel::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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue