mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Stay in bounds
This commit is contained in:
		
							parent
							
								
									1c62bc06cf
								
							
						
					
					
						commit
						05c1816504
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		|  | @ -557,6 +557,9 @@ void NCCHContainer::ApplyIPS(std::vector<u8>& ips, std::vector<u8>& buffer) { | ||||||
|         if (length == 0) { |         if (length == 0) { | ||||||
|             length = ips[cursor + 5] << 8 | ips[cursor + 6]; |             length = ips[cursor + 5] << 8 | ips[cursor + 6]; | ||||||
| 
 | 
 | ||||||
|  |             if (buffer.size() < offset + length) | ||||||
|  |                 return; | ||||||
|  | 
 | ||||||
|             for (u32 i = 0; i < length; ++i) |             for (u32 i = 0; i < length; ++i) | ||||||
|                 buffer[offset + i] = ips[cursor + 7]; |                 buffer[offset + i] = ips[cursor + 7]; | ||||||
| 
 | 
 | ||||||
|  | @ -565,6 +568,9 @@ void NCCHContainer::ApplyIPS(std::vector<u8>& ips, std::vector<u8>& buffer) { | ||||||
|             continue; |             continue; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         if (buffer.size() < offset + length) | ||||||
|  |             return; | ||||||
|  | 
 | ||||||
|         std::memcpy(&buffer[offset], &ips[cursor + 5], length); |         std::memcpy(&buffer[offset], &ips[cursor + 5], length); | ||||||
|         cursor += length + 5; |         cursor += length + 5; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue