mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	check for chunk size
This commit is contained in:
		
							parent
							
								
									20341a381f
								
							
						
					
					
						commit
						bc5ff37e37
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		
							
								
								
									
										8
									
								
								util.cpp
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								util.cpp
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -106,11 +106,15 @@ namespace http
 | 
			
		|||
		while (!response.eof ())
 | 
			
		||||
		{	
 | 
			
		||||
			std::string hexLen;
 | 
			
		||||
			int len;
 | 
			
		||||
			size_t len;
 | 
			
		||||
			std::getline (response, hexLen);
 | 
			
		||||
			std::istringstream iss (hexLen);
 | 
			
		||||
			iss >> std::hex >> len;
 | 
			
		||||
			if (!len) break;
 | 
			
		||||
			if (!len || len > 10000000L) // 10M
 | 
			
		||||
			{
 | 
			
		||||
				LogPrint (eLogError, "Unexpected chunk length ", len);
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			char * buf = new char[len];
 | 
			
		||||
			response.read (buf, len);
 | 
			
		||||
			merged.write (buf, len);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue