mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	Fix infinite parse of recursive definitions
Fixed the infinite parse (and eventually segfault) of recursive definitions. Also fixed the parse of a string slave PCM of direct plugins.
This commit is contained in:
		
							parent
							
								
									bf174b7046
								
							
						
					
					
						commit
						eccc92a34d
					
				
					 29 changed files with 127 additions and 36 deletions
				
			
		
							
								
								
									
										19
									
								
								src/conf.c
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								src/conf.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -440,6 +440,7 @@ struct _snd_config {
 | 
			
		|||
	} u;
 | 
			
		||||
	struct list_head list;
 | 
			
		||||
	snd_config_t *father;
 | 
			
		||||
	int hop;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct filedesc {
 | 
			
		||||
| 
						 | 
				
			
			@ -4011,6 +4012,24 @@ int snd_config_search_definition(snd_config_t *config,
 | 
			
		|||
	return snd_config_expand(conf, config, args, NULL, result);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef DOC_HIDDEN
 | 
			
		||||
void snd_config_set_hop(snd_config_t *conf, int hop)
 | 
			
		||||
{
 | 
			
		||||
	conf->hop = hop;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int snd_config_check_hop(snd_config_t *conf)
 | 
			
		||||
{
 | 
			
		||||
	if (conf) {
 | 
			
		||||
		if (conf->hop >= SND_CONF_MAX_HOPS) {
 | 
			
		||||
			SYSERR("Too many definition levels (looped?)\n");
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
		}
 | 
			
		||||
		return conf->hop;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
/* Not strictly needed, but useful to check for memory leaks */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue