Module: kamailio
Branch: master
Commit: b02b8e82a3afec2c0f7f954b5a996476808ee3c6
URL: 
https://github.com/kamailio/kamailio/commit/b02b8e82a3afec2c0f7f954b5a996476808ee3c6

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2019-04-23T20:51:10+02:00

dialog: handle case of null contact->s value

- get over static analyzer report

---

Modified: src/modules/dialog/dlg_hash.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/b02b8e82a3afec2c0f7f954b5a996476808ee3c6.diff
Patch: 
https://github.com/kamailio/kamailio/commit/b02b8e82a3afec2c0f7f954b5a996476808ee3c6.patch

---

diff --git a/src/modules/dialog/dlg_hash.c b/src/modules/dialog/dlg_hash.c
index 5c11bada52..6035a74f6e 100644
--- a/src/modules/dialog/dlg_hash.c
+++ b/src/modules/dialog/dlg_hash.c
@@ -584,7 +584,13 @@ int dlg_set_leg_info(struct dlg_cell *dlg, str* tag, str 
*rr, str *contact,
 
        /* contact */
        dlg->contact[leg].len = contact->len;
-       memcpy(dlg->contact[leg].s, contact->s, contact->len);
+       if(contact->s) {
+               memcpy(dlg->contact[leg].s, contact->s, contact->len);
+       } else {
+               if(contact->len>0) {
+                       memset(dlg->contact[leg].s, 0, contact->len);
+               }
+       }
        /* cseq */
        dlg->cseq[leg].len = cs.len;
        memcpy( dlg->cseq[leg].s, cs.s, cs.len);


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to