From: Michael Jerris Date: Tue, 21 Sep 2010 19:31:36 +0000 (-0500) Subject: fix seg on subscribe with no contact host X-Git-Tag: v1.2-rc1~291^2~40^2~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c236541e29b022d4fef66958ce796165ab15ea44;p=thirdparty%2Ffreeswitch.git fix seg on subscribe with no contact host --- diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 5eb71b37e9..333f31b91d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1983,12 +1983,20 @@ void sofia_presence_handle_sip_i_subscribe(int status, is_nat = NULL; } + if (zstr(contact_host)) { + is_nat = "No contact host"; + } + if (is_nat) { contact_host = network_ip; switch_snprintf(new_port, sizeof(new_port), ":%d", network_port); port = NULL; } + if (zstr(contact_host)) { + nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END()); + return; + } if (port) { switch_snprintf(new_port, sizeof(new_port), ":%s", port);