[sr-dev] git:master: modules_k/msilo: Fixed a bad memcpy used for the storage of extra headers in MSilo

Peter Dunkley peter.dunkley at crocodile-rcs.com
Sun Nov 20 23:13:06 CET 2011


Module: sip-router
Branch: master
Commit: a5c30f50d0db9b57954bd74643c6b130f10e233c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a5c30f50d0db9b57954bd74643c6b130f10e233c

Author: pd <peter.dunkley at crocodile-rcs.com>
Committer: pd <peter.dunkley at crocodile-rcs.com>
Date:   Sun Nov 20 21:43:58 2011 +0000

modules_k/msilo: Fixed a bad memcpy used for the storage of extra headers in MSilo
- Problem found and fixed by Hugh Waite @ Crocodile RCS

---

 modules_k/msilo/msilo.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules_k/msilo/msilo.c b/modules_k/msilo/msilo.c
index 5be2f70..cb23b2b 100644
--- a/modules_k/msilo/msilo.c
+++ b/modules_k/msilo/msilo.c
@@ -1066,7 +1066,7 @@ static int m_dump(struct sip_msg* msg, str* owner_s)
 		}
 
 		tmp_extra_hdrs.len = extra_hdrs_str.len+str_vals[4].len;
-		if ((tmp_extra_hdrs.s = pkg_malloc(tmp_extra_hdrs.len+1)) == NULL)
+		if ((tmp_extra_hdrs.s = pkg_malloc(tmp_extra_hdrs.len)) == NULL)
 		{
 			LM_ERR("Out of pkg memory");
 			if (msilo_dbf.free_result(db_con, db_res) < 0)
@@ -1074,8 +1074,8 @@ static int m_dump(struct sip_msg* msg, str* owner_s)
 			msg_list_set_flag(ml, mid, MS_MSG_ERRO);
 			goto error;
 		}
-		snprintf(tmp_extra_hdrs.s, tmp_extra_hdrs.len, "%.*s%.*s", extra_hdrs_str.len, extra_hdrs_str.s,
-						str_vals[4].len, str_vals[4].s);
+		memcpy(tmp_extra_hdrs.s, extra_hdrs_str.s, extra_hdrs_str.len);
+		memcpy(tmp_extra_hdrs.s+extra_hdrs_str.len, str_vals[4].s, str_vals[4].len);
 		
 		hdr_str.len = 1024;
 		if(m_build_headers(&hdr_str, str_vals[3] /*ctype*/,




More information about the sr-dev mailing list