Module: sip-router
Branch: 4.0
Commit: 1103009d674b2bf7a6c31e4d351d832370dded58
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1103009…
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
(cherry picked from commit 082a6c43938cf8e3839d46fd070e391bd522d4ed)
---
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 bba619a..6081165 100644
--- a/modules/dialog/dlg_hash.c
+++ b/modules/dialog/dlg_hash.c
@@ -484,18 +484,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) {
@@ -531,8 +537,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;
}