Merge remote-tracking branch 'ghsa-cjq6-6gwv-qxjj/advisory-fix-1'

This commit is contained in:
djmaze 2026-11-03 15:28:28 +01:00
commit d3fec0da5f

View file

@ -234,14 +234,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);