Module: sip-router
Branch: master
Commit: 082a6c43938cf8e3839d46fd070e391bd522d4ed
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=082a6c4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Nov 5 10:33:55 2013 +0100
dialog: init cseq to 0 if not available yet for one side
- based on a report by Morten Isaksen
---
modules/dialog/dlg_hash.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c
index 6f944e1..d346800 100644
--- a/modules/dialog/dlg_hash.c
+++ b/modules/dialog/dlg_hash.c
@@ -517,18 +517,24 @@ int dlg_set_leg_info(struct dlg_cell *dlg, str* tag, str *rr, str
*contact,
str *cseq, unsigned int leg)
{
char *p;
+ str cs = {"0", 1};
+
+ /* if we don't have cseq, set it to 0 */
+ if(cseq->len>0) {
+ cs = *cseq;
+ }
if(dlg->tag[leg].s)
shm_free(dlg->tag[leg].s);
dlg->tag[leg].s = (char*)shm_malloc( tag->len + rr->len + contact->len );
if(dlg->cseq[leg].s) {
- if (dlg->cseq[leg].len < cseq->len) {
+ if (dlg->cseq[leg].len < cs.len) {
shm_free(dlg->cseq[leg].s);
- dlg->cseq[leg].s = (char*)shm_malloc(cseq->len);
+ dlg->cseq[leg].s = (char*)shm_malloc(cs.len);
}
} else {
- dlg->cseq[leg].s = (char*)shm_malloc( cseq->len );
+ dlg->cseq[leg].s = (char*)shm_malloc( cs.len );
}
if ( dlg->tag[leg].s==NULL || dlg->cseq[leg].s==NULL) {
@@ -564,8 +570,8 @@ int dlg_set_leg_info(struct dlg_cell *dlg, str* tag, str *rr, str
*contact,
}
/* cseq */
- dlg->cseq[leg].len = cseq->len;
- memcpy( dlg->cseq[leg].s, cseq->s, cseq->len);
+ dlg->cseq[leg].len = cs.len;
+ memcpy( dlg->cseq[leg].s, cs.s, cs.len);
return 0;
}