<p>fixeria <strong>uploaded patch set #9</strong> to this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-msc/+/13470">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">libmsc/db.c: fix potential integer overflow<br><br>The value of 'sms->user_data_len' is fetched from the database:<br><br>  sms->user_data_len = dbi_result_get_field_length(result, "user_data");<br><br>and this is where the problem is. As per the libdbi's documentation<br>(see 3.5.3), dbi_result_get_field_length() returns the length in<br>bytes of the value stored in the specified field:<br><br>  unsigned int dbi_result_get_field_length(dbi_result Result,<br>                                           const char *fieldname)<br><br>so 'unsigned int' is assigned to 'uint8_t', what could lead to an<br>integer overflow if the value is grather than 0xff. As a result,<br>if the database for some reason does contain such odd TP-UD,<br>the truncation of 'user_data' would be done incorrectly.<br><br>Let's avoid such direct assignment, and use a separate variable.<br>Also, let's warn user if TP-UDL value is grether than 140, as<br>per 3GPP TS 03.40.<br><br>Change-Id: Ibbd588545e1a4817504c806a3d02cf59d5938ee2<br>Related: OS#3684<br>---<br>M src/libmsc/db.c<br>1 file changed, 27 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/70/13470/9</pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-msc/+/13470">change 13470</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/c/osmo-msc/+/13470"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-msc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ibbd588545e1a4817504c806a3d02cf59d5938ee2 </div>
<div style="display:none"> Gerrit-Change-Number: 13470 </div>
<div style="display:none"> Gerrit-PatchSet: 9 </div>
<div style="display:none"> Gerrit-Owner: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>