mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	fixed safe_strtoll to check the following characters.
This commit is contained in:
		
							parent
							
								
									46761b6ad3
								
							
						
					
					
						commit
						f726799483
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -463,10 +463,13 @@ typedef struct {
 | 
			
		|||
int safe_strtoll(const char *str, long long *val)
 | 
			
		||||
{
 | 
			
		||||
	long long v;
 | 
			
		||||
	int endidx;
 | 
			
		||||
	if (!*str)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	errno = 0;
 | 
			
		||||
	if (sscanf(str, "%Ld", &v) != 1)
 | 
			
		||||
	if (sscanf(str, "%Ld%n", &v, &endidx) < 1)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	if (str[endidx])
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	*val = v;
 | 
			
		||||
	return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue