mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Cleanup: prevent potential out of bounds write
Since we cannot store tanks / gases past MAX_CYLINDERS (currently 20), there is no point in analyzing those data. Coverity CID 208339 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									efb2640fc7
								
							
						
					
					
						commit
						0e94c21a55
					
				
					 1 changed files with 2 additions and 5 deletions
				
			
		| 
						 | 
					@ -115,7 +115,7 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	bool no_volume = true;
 | 
						bool no_volume = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < ngases || i < ntanks; i++) {
 | 
						for (i = 0; i < MAX_CYLINDERS && (i < ngases || i < ntanks); i++) {
 | 
				
			||||||
		if (i < ngases) {
 | 
							if (i < ngases) {
 | 
				
			||||||
			dc_gasmix_t gasmix = { 0 };
 | 
								dc_gasmix_t gasmix = { 0 };
 | 
				
			||||||
			int o2, he;
 | 
								int o2, he;
 | 
				
			||||||
| 
						 | 
					@ -124,9 +124,6 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
 | 
				
			||||||
			if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED)
 | 
								if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED)
 | 
				
			||||||
				return rc;
 | 
									return rc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (i >= MAX_CYLINDERS)
 | 
					 | 
				
			||||||
				continue;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			o2 = lrint(gasmix.oxygen * 1000);
 | 
								o2 = lrint(gasmix.oxygen * 1000);
 | 
				
			||||||
			he = lrint(gasmix.helium * 1000);
 | 
								he = lrint(gasmix.helium * 1000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue