Commit dec2d85c authored by Simon Morlat's avatar Simon Morlat

fix potential crash because tport_name_t::tpn_host may be null

parent cf90ef53
......@@ -11,7 +11,7 @@ dnl information on the package
dnl ---------------------------
dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
AC_INIT([sofia-sip], [1.13.12bc])
AC_INIT([sofia-sip], [1.13.13bc])
AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.13])
......
......@@ -4683,12 +4683,13 @@ tport_t *tport_by_name(tport_t const *tp, tp_name_t const *tpn)
}
if (!default_primary) {
default_primary=tp;
} else if (strcmp(tpn->tpn_host, "127.0.0.1") == 0 || strcmp(tpn->tpn_host, "::1") == 0) {
if (family == AF_INET && strcmp(inet_ntoa(tp->tp_addr->su_sin.sin_addr), tpn->tpn_host) == 0) {
} else if (tpn->tpn_host && (strcmp(tpn->tpn_host, "127.0.0.1") == 0 || strcmp(tpn->tpn_host, "::1")) == 0) {
if ((family == AF_INET && ntohl(tp->tp_addr->su_sin.sin_addr.s_addr) == INADDR_LOOPBACK) ||
(family == AF_INET6 && IN6_IS_ADDR_LOOPBACK(&tp->tp_addr->su_sin6.sin6_addr))) {
SU_DEBUG_7(("tport: default primary changed to loopback\n"));
default_primary = tp;
}
}
}
secondary=tport_by_name_from_primary(tp,tpn);
if (secondary) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment