mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Avoid crashes with nested multipart/mixed parts.
This commit is contained in:
		
							parent
							
								
									14d1c721d5
								
							
						
					
					
						commit
						f789ee4a86
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -367,7 +367,14 @@ def mimify_part(ifile, ofile, is_mime):
 | 
				
			||||||
	line = message_end
 | 
						line = message_end
 | 
				
			||||||
	while multipart:
 | 
						while multipart:
 | 
				
			||||||
		if line == multipart + '--\n':
 | 
							if line == multipart + '--\n':
 | 
				
			||||||
 | 
								# read bit after the end of the last part
 | 
				
			||||||
 | 
								while 1:
 | 
				
			||||||
 | 
									line = ifile.readline()
 | 
				
			||||||
 | 
									if not line:
 | 
				
			||||||
					return
 | 
										return
 | 
				
			||||||
 | 
									if must_quote_body:
 | 
				
			||||||
 | 
										line = mime_encode(line, 0)
 | 
				
			||||||
 | 
									ofile.write(line)
 | 
				
			||||||
		if line == multipart + '\n':
 | 
							if line == multipart + '\n':
 | 
				
			||||||
			nifile = File(ifile, multipart)
 | 
								nifile = File(ifile, multipart)
 | 
				
			||||||
			mimify_part(nifile, ofile, 1)
 | 
								mimify_part(nifile, ofile, 1)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue