mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-03 19:08:50 +03:00
Scramble foreignObject in SVG files
This commit is contained in:
parent
61ebcb6ed4
commit
57de7eed1a
1 changed files with 8 additions and 1 deletions
|
|
@ -219,14 +219,21 @@ trait Raw
|
|||
\header('Content-Transfer-Encoding: binary');
|
||||
}
|
||||
|
||||
// https://github.com/the-djmaze/snappymail/security/advisories/GHSA-cjq6-6gwv-qxjj
|
||||
$bSVG = ('image/svg+xml' === $sContentType) || ('.svg' === \substr($sFileName, -4));
|
||||
|
||||
$sLoadedData = null;
|
||||
if ($bIsRangeRequest || !$bDownload) {
|
||||
if ($bIsRangeRequest || !$bDownload || $bSVG) {
|
||||
$sLoadedData = \stream_get_contents($rResource);
|
||||
}
|
||||
|
||||
\MailSo\Base\Utils::ResetTimeLimit();
|
||||
|
||||
if ($sLoadedData) {
|
||||
if ($bSVG) {
|
||||
$sLoadedData = \str_replace('foreignObject' ,'foreign-Object', $sLoadedData);
|
||||
}
|
||||
|
||||
if ($bIsRangeRequest && (\strlen($sRangeStart) || \strlen($sRangeEnd))) {
|
||||
$iFullContentLength = \strlen($sLoadedData);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue