Cap editorconfig line length to 256

Thanks to Naglis Jonaitis for pointing out the opportunity for a DoS
through this.

Signed-off-by: Drew DeVault <sir@cmpwn.com>
This commit is contained in:
Drew DeVault 2024-04-12 10:10:00 +02:00
parent 077615094c
commit 7144962487
1 changed files with 4 additions and 1 deletions

View File

@ -63,7 +63,10 @@ class EditorConfig:
if self._config == None:
return 80
try:
return int(self._config.get("max_line_length", 80))
length = int(self._config.get("max_line_length", 80))
if length > 256:
length = 80
return length
except ValueError:
return 80