mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	ucm: fix parsing of the internal hexadecimal card identifier
Too many code was removed.
Fixes: f547b2e3 ("conf: introduce safe_strtol_base()")
Fixes: https://github.com/alsa-project/alsa-lib/issues/188
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
			
			
This commit is contained in:
		
							parent
							
								
									ea5481296f
								
							
						
					
					
						commit
						050f18c525
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
					@ -811,6 +811,7 @@ void uc_mgr_card_close(snd_use_case_mgr_t *uc_mgr)
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
const char *uc_mgr_alibcfg_by_device(snd_config_t **top, const char *name)
 | 
					const char *uc_mgr_alibcfg_by_device(snd_config_t **top, const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						char buf[5];
 | 
				
			||||||
	long card_num;
 | 
						long card_num;
 | 
				
			||||||
	snd_config_t *config;
 | 
						snd_config_t *config;
 | 
				
			||||||
	snd_use_case_mgr_t *uc_mgr;
 | 
						snd_use_case_mgr_t *uc_mgr;
 | 
				
			||||||
| 
						 | 
					@ -818,6 +819,8 @@ const char *uc_mgr_alibcfg_by_device(snd_config_t **top, const char *name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (strncmp(name, "_ucm", 4) || strlen(name) < 12 || name[8] != '.')
 | 
						if (strncmp(name, "_ucm", 4) || strlen(name) < 12 || name[8] != '.')
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
						strncpy(buf, name + 4, 4);
 | 
				
			||||||
 | 
						buf[4] = '\0';
 | 
				
			||||||
	err = safe_strtol_base(name, &card_num, 16);
 | 
						err = safe_strtol_base(name, &card_num, 16);
 | 
				
			||||||
	if (err < 0 || card_num < 0 || card_num > 0xffff)
 | 
						if (err < 0 || card_num < 0 || card_num > 0xffff)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue