diff --git a/src/modules/dialog/dlg_handlers.c b/src/modules/dialog/dlg_handlers.c index b6ce4d2bbdd..a94dd641a42 100644 --- a/src/modules/dialog/dlg_handlers.c +++ b/src/modules/dialog/dlg_handlers.c @@ -200,7 +200,7 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg, if (leg==DLG_CALLER_LEG) { if((!msg->cseq && (parse_headers(msg,HDR_CSEQ_F,0)<0 || !msg->cseq)) || !msg->cseq->parsed){ - LM_ERR("bad sip message or missing CSeq hdr :-/\n"); + LM_ERR("bad sip message or missing CSeq hdr\n"); goto error0; } cseq = (get_cseq(msg))->number; @@ -208,6 +208,10 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg, /* use the same as in request */ cseq = dlg->cseq[DLG_CALLEE_LEG]; } + if(cseq.s==NULL || cseq.len<=0) { + LM_ERR("empty CSeq number\n"); + goto error0; + } /* extract the contact address */ if (!msg->contact&&(parse_headers(msg,HDR_CONTACT_F,0)<0||!msg->contact)){ @@ -221,6 +225,10 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg, goto error0; } contact = ((contact_body_t *)msg->contact->parsed)->contacts->uri; + if(contact.s==NULL || contact.len<=0) { + LM_ERR("empty contact uri\n"); + goto error0; + } /* extract the record-route addresses */ if (leg==DLG_CALLER_LEG) { @@ -250,10 +258,10 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg, LM_DBG("leg(%d) route_set [%.*s], contact [%.*s], cseq [%.*s]" " and bind_addr [%.*s]\n", - leg, rr_set.len, rr_set.s, contact.len, contact.s, - cseq.len, cseq.s, + leg, rr_set.len, ZSW(rr_set.s), contact.len, ZSW(contact.s), + cseq.len, ZSW(cseq.s), msg->rcv.bind_address->sock_str.len, - msg->rcv.bind_address->sock_str.s); + ZSW(msg->rcv.bind_address->sock_str.s)); if (dlg_set_leg_info( dlg, tag, &rr_set, &contact, &cseq, leg)!=0) { LM_ERR("dlg_set_leg_info failed (leg %d)\n", leg);