mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	Merge "dns_core: Protect against array index violation."
This commit is contained in:
		| @@ -447,9 +447,13 @@ static dns_alloc_fn dns_alloc_table [] = { | |||||||
| 	[T_SRV] = dns_srv_alloc, | 	[T_SRV] = dns_srv_alloc, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| static struct ast_dns_record *allocate_dns_record(int rr_type, struct ast_dns_query *query, const char *data, const size_t size) | static struct ast_dns_record *allocate_dns_record(unsigned int rr_type, struct ast_dns_query *query, const char *data, const size_t size) | ||||||
| { | { | ||||||
| 	dns_alloc_fn allocator = dns_alloc_table[rr_type] ?: generic_record_alloc; | 	dns_alloc_fn allocator = generic_record_alloc; | ||||||
|  |  | ||||||
|  | 	if (rr_type < ARRAY_LEN(dns_alloc_table) && dns_alloc_table[rr_type]) { | ||||||
|  | 		allocator = dns_alloc_table[rr_type]; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	return allocator(query, data, size); | 	return allocator(query, data, size); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user