sipdump: safety check for local socket pointer
authorDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 8 May 2020 16:01:13 +0000 (18:01 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 8 May 2020 16:01:13 +0000 (18:01 +0200)
- use generic address is not set

src/modules/sipdump/sipdump_mod.c

index ad867ff..e61fea0 100644 (file)
@@ -433,8 +433,14 @@ int sipdump_msg_sent(sr_event_param_t *evp)
        sdi.tag.s = "snd";
        sdi.tag.len = 3;
 
-       sdi.src_ip = evp->dst->send_sock->address_str;
-       sdi.src_port = (int)evp->dst->send_sock->port_no;
+       if(evp->dst->send_sock==NULL || evp->dst->send_sock->address_str.s==NULL) {
+               sdi.src_ip.len = 7;
+               sdi.src_ip.s = "0.0.0.0";
+               sdi.src_port = 0;
+       } else {
+               sdi.src_ip = evp->dst->send_sock->address_str;
+               sdi.src_port = (int)evp->dst->send_sock->port_no;
+       }
        su2ip_addr(&ip, &evp->dst->to);
        sdi.dst_ip.len = ip_addr2sbufz(&ip, dstip_buf, IP_ADDR_MAX_STRZ_SIZE);
        sdi.dst_ip.s = dstip_buf;