Module: sip-router Branch: master Commit: c618a65e1941dc1ae259f97d264dd99a00aaf097 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c618a65e...
Author: Marius Zbihlei marius.zbihlei@1and1.ro Committer: Marius Zbihlei marius.zbihlei@1and1.ro Date: Wed Apr 25 14:54:31 2012 +0300
modules/sipcapture: Fixed crash in case contact was "*" (cherry picked from commit 11ca33836fdd33d7c3d36c4f1acc6c6782edfb5d)
---
modules/sipcapture/sipcapture.c | 25 ++++++++++++++++++------- 1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c index 6905f85..ce7251d 100644 --- a/modules/sipcapture/sipcapture.c +++ b/modules/sipcapture/sipcapture.c @@ -188,7 +188,7 @@ static str type_column = str_init("type"); static str node_column = str_init("node"); static str msg_column = str_init("msg"); static str capture_node = str_init("homer01"); - +static str star_contact = str_init("*");
int raw_sock_desc = -1; /* raw socket used for ip packets */ unsigned int raw_sock_children = 1; @@ -1176,12 +1176,23 @@ static int sip_capture(struct sip_msg *msg, char *s1, char *s2)
cb = (contact_body_t*)msg->contact->parsed;
- if(cb && cb->contacts) { - if(parse_uri( cb->contacts->uri.s, cb->contacts->uri.len, &contact)<0){ - LOG(L_ERR, "ERROR: do_action: bad contact dropping"" packet\n"); - return -1; - } - } + if(cb) { + if (cb->contacts) { + if(parse_uri( cb->contacts->uri.s, cb->contacts->uri.len, &contact)<0){ + LOG(L_ERR, "ERROR: do_action: bad contact dropping"" packet\n"); + return -1; + } + } else { + if(cb->star){ /* in the case Contact is "*" */ + memset(&contact, 0, sizeof(contact)); + contact.user.s = star_contact.s; + contact.user.len = star_contact.len; + } else { + LOG(L_NOTICE,"Invalid contact\n"); + memset(&contact, 0, sizeof(contact)); + } + } + } }
/* get header x-cid: */