From 473fd7296a97477938a7c7daa03819f042282e1f Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Tue, 21 Oct 2014 14:18:27 +0200 Subject: [PATCH] media: avoid segfault in fill_zero_tcp_act_ports_from_tcp_pass() --- src/core/sipe-media.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/sipe-media.c b/src/core/sipe-media.c index a477ce77..1fa6570f 100644 --- a/src/core/sipe-media.c +++ b/src/core/sipe-media.c @@ -237,8 +237,13 @@ fill_zero_tcp_act_ports_from_tcp_pass(GSList *candidates) for (i = candidates; i; i = i->next) { struct sdpcandidate *c = i->data; if (c->type == SIPE_CANDIDATE_TYPE_RELAY && c->base_port == 0) { - c->base_port = *(guint*)g_hash_table_lookup(ip_to_port, - c->base_ip); + guint *base_port = (guint*)g_hash_table_lookup(ip_to_port, c->base_ip); + if (base_port) { + c->base_port = *base_port; + } else { + SIPE_DEBUG_WARNING("Couldn't determine base port for candidate " + "with foundation %s", c->foundation); + } } } -- 2.11.4.GIT