mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	cleanup: fix possbile buffer overrun
No reason to mess around with a 5 byte buffer when we have a proper buffer available to receive a possibly 8 byte output based on the format string. And silences compiler warning. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
		
							parent
							
								
									3e2caa468e
								
							
						
					
					
						commit
						0096284a8e
					
				
					 1 changed files with 2 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -299,7 +299,6 @@ void uemis_parse_divelog_binary(char *base64, void *datap)
 | 
			
		|||
	struct divecomputer *dc = &dive->dc;
 | 
			
		||||
	int template, gasoffset;
 | 
			
		||||
	uint8_t active = 0;
 | 
			
		||||
	char version[5];
 | 
			
		||||
 | 
			
		||||
	datalen = uemis_convert_base64(base64, &data);
 | 
			
		||||
	dive->dc.airtemp.mkelvin = C_to_mkelvin((*(uint16_t *)(data + 45)) / 10.0);
 | 
			
		||||
| 
						 | 
				
			
			@ -374,8 +373,8 @@ void uemis_parse_divelog_binary(char *base64, void *datap)
 | 
			
		|||
	/* get data from the footer */
 | 
			
		||||
	char buffer[24];
 | 
			
		||||
 | 
			
		||||
	snprintf(version, sizeof(version), "%1u.%02u", data[18], data[17]);
 | 
			
		||||
	add_extra_data(dc, "FW Version", version);
 | 
			
		||||
	snprintf(buffer, sizeof(buffer), "%1u.%02u", data[18], data[17]);
 | 
			
		||||
	add_extra_data(dc, "FW Version", buffer);
 | 
			
		||||
	snprintf(buffer, sizeof(buffer), "%08x", *(uint32_t *)(data + 9));
 | 
			
		||||
	add_extra_data(dc, "Serial", buffer);
 | 
			
		||||
	snprintf(buffer, sizeof(buffer), "%d", *(uint16_t *)(data + i + 35));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue