<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13211">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">amr: be sure result of osmo_amr_bwe_to_oa() fits into int buf<br><br>osmo_amr_bwe_to_oa() uses an internal buffer with static size to store<br>intermediate results. The buffer is large enough for any real world<br>situation, but the check that tests if the result would fit into the<br>internal buffer is incorrect. It checks if there is enough room for the<br>existing payload, but does not include the expected growth of the<br>payload. Eventually the buffer could be overrun by one byte if one would<br>put a 256 byte long AMR payload.<br><br>Fixes: CID#195926<br>Change-Id: I4d7ac570a0b48368a82183673c46bca5f235f228<br>---<br>M src/amr.c<br>1 file changed, 1 insertion(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/11/13211/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/amr.c b/src/amr.c</span><br><span>index 9b423e8..9c63f60 100644</span><br><span>--- a/src/amr.c</span><br><span>+++ b/src/amr.c</span><br><span>@@ -158,7 +158,7 @@</span><br><span>      if (payload_len + 1 > payload_maxlen)</span><br><span>             return -1;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  if (payload_len > sizeof(buf))</span><br><span style="color: hsl(120, 100%, 40%);">+     if (payload_len + 1 > sizeof(buf))</span><br><span>                return -1;</span><br><span> </span><br><span>       buf[0] = payload[0] & 0xf0;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13211">change 13211</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/13211"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmo-netif </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I4d7ac570a0b48368a82183673c46bca5f235f228 </div>
<div style="display:none"> Gerrit-Change-Number: 13211 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>