<p>osmith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13048">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gsup_router.c: gsup_route_find(): support blob<br><br>Do not require the blob (addr, addr_len) passed to gsup_route_find()<br>to be nul-terminated. We already have the length, so the nul-termination<br>is redundant.<br><br>This is needed for the upcoming gsup message forwarding patch [1]: we<br>want to be able to directly pass non-nul-terminated source and<br>destination name blobs to gsup_route_find().<br><br>I have looked into fixing all code that calls gsup_route_find() to never<br>pass a nul-terminated blob combination. But this is a can of worms,<br>because it involves both gsup client and server code. Wireshark shows<br>that clients are sending the nul-terminated string in TLV IEs of IPA<br>messages. The server assumes that this is the case in various places.<br>So we would need to fix it in both (server and client), but then we<br>would lose backwards compatibility with old servers and clients.<br><br>[1]: change-id Ia4f345abc877baaf0a8f73b8988e6514d9589bf5<br><br>Related: OS#3793<br>Change-Id: I01a45900e14d41bcd338f50ad85d9fabf2c61405<br>---<br>M src/gsup_router.c<br>1 file changed, 8 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/48/13048/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gsup_router.c b/src/gsup_router.c</span><br><span>index 16ea202..2101fb7 100644</span><br><span>--- a/src/gsup_router.c</span><br><span>+++ b/src/gsup_router.c</span><br><span>@@ -40,8 +40,14 @@</span><br><span>       struct gsup_route *gr;</span><br><span> </span><br><span>   llist_for_each_entry(gr, &gs->routes, list) {</span><br><span style="color: hsl(0, 100%, 40%);">-            if (talloc_total_size(gr->addr) == addrlen &&</span><br><span style="color: hsl(0, 100%, 40%);">-                    !memcmp(gr->addr, addr, addrlen))</span><br><span style="color: hsl(120, 100%, 40%);">+              size_t gr_addrlen = talloc_total_size(gr->addr); /* gr->addr is a nul-terminated string */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+            /* FIXME: despite passing addrlen, a lot of code assumes that addr is also nul-terminated */</span><br><span style="color: hsl(120, 100%, 40%);">+          if (gr_addrlen == addrlen && !memcmp(gr->addr, addr, addrlen))</span><br><span style="color: hsl(120, 100%, 40%);">+                     return gr->conn;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+         /* Compare addr as non-nul-terminated blob */</span><br><span style="color: hsl(120, 100%, 40%);">+         if (gr_addrlen - 1 == addrlen && !memcmp(gr->addr, addr, addrlen))</span><br><span>                        return gr->conn;</span><br><span>  }</span><br><span>    return NULL;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13048">change 13048</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/13048"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-hlr </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I01a45900e14d41bcd338f50ad85d9fabf2c61405 </div>
<div style="display:none"> Gerrit-Change-Number: 13048 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>