mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-01 23:57:05 +00:00
Limit readline()
This commit is contained in:
parent
a332be6a7b
commit
79073bad92
@ -186,7 +186,7 @@ def get_passphrase(env):
|
||||
# length of 32 bytes.
|
||||
backup_root = os.path.join(env["STORAGE_ROOT"], 'backup')
|
||||
with open(os.path.join(backup_root, 'secret_key.txt'), encoding="utf-8") as f:
|
||||
passphrase = f.readline().strip()
|
||||
passphrase = f.readline(5_000_000).strip()
|
||||
if len(passphrase) < 43: raise Exception("secret_key.txt's first line is too short!")
|
||||
|
||||
return passphrase
|
||||
|
@ -587,7 +587,7 @@ def readline(filename):
|
||||
"""
|
||||
with open(filename, errors='replace', encoding='utf-8') as file:
|
||||
while True:
|
||||
line = file.readline()
|
||||
line = file.readline(5_000_000)
|
||||
if not line:
|
||||
break
|
||||
yield line
|
||||
|
Loading…
Reference in New Issue
Block a user