<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libusrp/+/25927">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">usrp_prims_common: fix use-after-free in get_proto_filename()<br><br>Every time the get_proto_filename() is called, a new instance<br>of std::string is allocated for the first argument.  When the<br>function returns, this instance gets deallocated.  Therefore,<br>the returned user_filename.c_str() points to free()d memory.<br><br>Change-Id: Ib0007e9aebd9e77c28531c1ec70c61f1723a2d0d<br>Fixes: CID#240724<br>---<br>M host/lib/usrp_prims_common.cc<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/libusrp refs/changes/27/25927/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/host/lib/usrp_prims_common.cc b/host/lib/usrp_prims_common.cc</span><br><span>index 20a5565..ca9b447 100644</span><br><span>--- a/host/lib/usrp_prims_common.cc</span><br><span>+++ b/host/lib/usrp_prims_common.cc</span><br><span>@@ -85,7 +85,7 @@</span><br><span> }</span><br><span> </span><br><span> static const char *</span><br><span style="color: hsl(0, 100%, 40%);">-get_proto_filename(const std::string user_filename, const char *env_var, const char *def)</span><br><span style="color: hsl(120, 100%, 40%);">+get_proto_filename(const std::string &user_filename, const char *env_var, const char *def)</span><br><span> {</span><br><span>   if (user_filename.length() != 0)</span><br><span>     return user_filename.c_str();</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libusrp/+/25927">change 25927</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/libusrp/+/25927"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libusrp </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib0007e9aebd9e77c28531c1ec70c61f1723a2d0d </div>
<div style="display:none"> Gerrit-Change-Number: 25927 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>