Module: sip-router
Branch: master
Commit: 68a8ef2ed9e616f563a28d87d591f5deebd23085
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=68a8ef2…
Author: Jason Penton <jason.penton(a)smilecoms.com>
Committer: Jason Penton <jason.penton(a)smilecoms.com>
Date: Tue Apr 2 20:29:50 2013 +0200
modules/dialog_ng: fixed bad append bug and added null sentinel
- thanks Hugh
---
modules/dialog_ng/dlg_hash.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules/dialog_ng/dlg_hash.c b/modules/dialog_ng/dlg_hash.c
index 51f8eec..6bfdde3 100644
--- a/modules/dialog_ng/dlg_hash.c
+++ b/modules/dialog_ng/dlg_hash.c
@@ -1267,15 +1267,16 @@ int dlg_set_toroute(struct dlg_cell *dlg, str * route) {
* \return void
*/
void create_concurrent_did(struct dlg_cell *dlg, str * new_did) {
- int len = dlg->did.len + 1;
+ int len = dlg->did.len + 1 + 1;
new_did->s = shm_malloc(len);
if (new_did->s == 0) {
LM_ERR("no more shm mem (%d)\n", len);
return;
}
+ memset(new_did->s, 0, len);
memcpy(new_did->s, dlg->did.s, dlg->did.len);
- new_did->s[len]= 'x';
- new_did->len = len;
+ new_did->s[dlg->did.len] = 'x';
+ new_did->len = dlg->did.len + 1;
}
/*!