Skip to content
Snippets Groups Projects
Commit b8f54f74 authored by Corey Farrell's avatar Corey Farrell
Browse files

dns_core: Protect against array index violation.

Add a check to allocate_dns_record to prevent calling a pointer
retrieved from beyond dns_alloc_table.

ASTERISK-27495 #close

Change-Id: Ie2f6e4991cea46baa12e837bd64cc22b44d322bb
parent a100bacc
No related branches found
No related tags found
No related merge requests found
......@@ -447,9 +447,13 @@ static dns_alloc_fn dns_alloc_table [] = {
[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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment