<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7664">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">dns_core: Protect against array index violation.<br><br>Add a check to allocate_dns_record to prevent calling a pointer<br>retrieved from beyond dns_alloc_table.<br><br>ASTERISK-27495 #close<br><br>Change-Id: Ie2f6e4991cea46baa12e837bd64cc22b44d322bb<br>---<br>M main/dns_core.c<br>1 file changed, 5 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/64/7664/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/dns_core.c b/main/dns_core.c<br>index a243b4b..8ce8b9f 100644<br>--- a/main/dns_core.c<br>+++ b/main/dns_core.c<br>@@ -449,7 +449,11 @@<br> <br> static struct ast_dns_record *allocate_dns_record(int rr_type, struct ast_dns_query *query, const char *data, const size_t size)<br> {<br>- dns_alloc_fn allocator = dns_alloc_table[rr_type] ?: generic_record_alloc;<br>+ dns_alloc_fn allocator = generic_record_alloc;<br>+<br>+ if (rr_type < ARRAY_LEN(dns_alloc_table) && dns_alloc_table[rr_type]) {<br>+ allocator = dns_alloc_table[rr_type];<br>+ }<br> <br> return allocator(query, data, size);<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7664">change 7664</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7664"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ie2f6e4991cea46baa12e837bd64cc22b44d322bb </div>
<div style="display:none"> Gerrit-Change-Number: 7664 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>