mirror of
				https://git.proxmox.com/git/mirror_iproute2
				synced 2025-11-04 06:22:48 +00:00 
			
		
		
		
	utils: fix hex digits parsing in hexstring_a2n()
strtoul() only modifies errno on overflow, so if errno is not zero before calling the function its value is preserved and makes the function fail for valid inputs; initialize it. Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
This commit is contained in:
		
							parent
							
								
									24604eb287
								
							
						
					
					
						commit
						9ba4126dc4
					
				@ -924,6 +924,7 @@ __u8 *hexstring_a2n(const char *str, __u8 *buf, int blen, unsigned int *len)
 | 
			
		||||
 | 
			
		||||
		strncpy(tmpstr, str, 2);
 | 
			
		||||
		tmpstr[2] = '\0';
 | 
			
		||||
		errno = 0;
 | 
			
		||||
		tmp = strtoul(tmpstr, &endptr, 16);
 | 
			
		||||
		if (errno != 0 || tmp > 0xFF || *endptr != '\0')
 | 
			
		||||
			return NULL;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user