[sr-dev] git:master:b02b8e82: dialog: handle case of null contact->s value
Daniel-Constantin Mierla
miconda at gmail.com
Wed Apr 24 11:34:41 CEST 2019
Module: kamailio
Branch: master
Commit: b02b8e82a3afec2c0f7f954b5a996476808ee3c6
URL: https://github.com/kamailio/kamailio/commit/b02b8e82a3afec2c0f7f954b5a996476808ee3c6
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
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);
More information about the sr-dev
mailing list