diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php
index fcb4e56c58..acfc63c227 100644
--- a/src/Symfony/Component/Debug/ExceptionHandler.php
+++ b/src/Symfony/Component/Debug/ExceptionHandler.php
@@ -382,10 +382,10 @@ EOF;
if ($linkFormat = $this->fileLinkFormat) {
$link = str_replace(array('%f', '%l'), array($path, $line), $linkFormat);
- return sprintf(' in %s line %d', $link, $file, $line);
+ return sprintf(' in %s line %d', htmlspecialchars($link), htmlspecialchars($file), $line);
}
- return sprintf(' in %s line %d', $path, $file, $line);
+ return sprintf(' in %s line %d', htmlspecialchars($path), htmlspecialchars($file), $line);
}
/**