mirror of
				https://github.com/mail-in-a-box/mailinabox.git
				synced 2025-10-30 18:50:53 +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. | 	# length of 32 bytes. | ||||||
| 	backup_root = os.path.join(env["STORAGE_ROOT"], 'backup') | 	backup_root = os.path.join(env["STORAGE_ROOT"], 'backup') | ||||||
| 	with open(os.path.join(backup_root, 'secret_key.txt'), encoding="utf-8") as f: | 	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!") | 	if len(passphrase) < 43: raise Exception("secret_key.txt's first line is too short!") | ||||||
| 
 | 
 | ||||||
| 	return passphrase | 	return passphrase | ||||||
|  | |||||||
| @ -587,7 +587,7 @@ def readline(filename): | |||||||
|     """ |     """ | ||||||
|     with open(filename, errors='replace', encoding='utf-8') as file: |     with open(filename, errors='replace', encoding='utf-8') as file: | ||||||
|         while True: |         while True: | ||||||
|           line = file.readline() |           line = file.readline(5_000_000) | ||||||
|           if not line: |           if not line: | ||||||
|               break |               break | ||||||
|           yield line |           yield line | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user