Skip to content

Commit 458efa7

Browse files
committed
restrict the maximum length of the X-Debug-Exception header
1 parent b5dba85 commit 458efa7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function render(\Throwable $exception): FlattenException
7272
{
7373
$headers = ['Content-Type' => 'text/html; charset='.$this->charset];
7474
if (\is_bool($this->debug) ? $this->debug : ($this->debug)($exception)) {
75-
$headers['X-Debug-Exception'] = rawurlencode($exception->getMessage());
75+
$headers['X-Debug-Exception'] = rawurlencode(substr($exception->getMessage(), 0, 2000));
7676
$headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
7777
}
7878

src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function render(\Throwable $exception): FlattenException
5858
$headers = ['Vary' => 'Accept'];
5959
$debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($exception);
6060
if ($debug) {
61-
$headers['X-Debug-Exception'] = rawurlencode($exception->getMessage());
61+
$headers['X-Debug-Exception'] = rawurlencode(substr($exception->getMessage(), 0, 2000));
6262
$headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
6363
}
6464

0 commit comments

Comments
 (0)