aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsup_router.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gsup_router.c')
-rw-r--r--src/gsup_router.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gsup_router.c b/src/gsup_router.c
index df978ba..0a9213d 100644
--- a/src/gsup_router.c
+++ b/src/gsup_router.c
@@ -40,8 +40,14 @@ struct osmo_gsup_conn *gsup_route_find(struct osmo_gsup_server *gs,
struct gsup_route *gr;
llist_for_each_entry(gr, &gs->routes, list) {
- if (talloc_total_size(gr->addr) == addrlen &&
- !memcmp(gr->addr, addr, addrlen))
+ size_t gr_addrlen = talloc_total_size(gr->addr); /* gr->addr is a nul-terminated string */
+
+ /* FIXME: despite passing addrlen, a lot of code assumes that addr is also nul-terminated */
+ if (gr_addrlen == addrlen && !memcmp(gr->addr, addr, addrlen))
+ return gr->conn;
+
+ /* Compare addr as non-nul-terminated blob */
+ if (gr_addrlen - 1 == addrlen && !memcmp(gr->addr, addr, addrlen))
return gr->conn;
}
return NULL;