<p><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/19888">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/19888/2/src/libosmo-mgcp-client/mgcp_client.c">File src/libosmo-mgcp-client/mgcp_client.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/19888/2/src/libosmo-mgcp-client/mgcp_client.c@a375">Patch Set #2, Line 375:</a> <code style="font-family:monospace,monospace">    if (st</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">you're removing any length checks in this function. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">How can they go out of bounds?<br>1- This same strlen() being here is telling (maybe a bug) that the string is null terminated.<br>2- Other string accesses afterwards like strncmp or pointer deferring early returns if string is different/shorter than expected.</p><p style="white-space: pre-wrap; word-wrap: break-word;">So the only real difference here is that I'm not early returning on super long lines (>16 chars, which anyway needed to be changed to accomodate ipv6 addresses), and in long lines anyway osmo_strlcpy would truncate to INET6_ADDRSTRLEN chars, so we are fine here.<br>The only thing I need to improve is checking the return code of osmo_strlcpy in case it was truncated, and then do early return.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-mgw/+/19888">change 19888</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-mgw/+/19888"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-mgw </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I936bf57d37f5f0607dfe7fc66c37e424c3793f9b </div>
<div style="display:none"> Gerrit-Change-Number: 19888 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 31 Aug 2020 08:36:53 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>