[sr-dev] git:master: siputils: allocate enough space to hold ending zero for tel uri in tel2sip()

Daniel-Constantin Mierla miconda at gmail.com
Thu May 15 14:00:02 CEST 2014


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu May 15 13:59:03 2014 +0200

siputils: allocate enough space to hold ending zero for tel uri in tel2sip()

- reported by Juha Heinanen

---

 modules/siputils/checks.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/siputils/checks.c b/modules/siputils/checks.c
index a1a9344..7f50cfc 100644
--- a/modules/siputils/checks.c
+++ b/modules/siputils/checks.c
@@ -354,7 +354,7 @@ int tel2sip(struct sip_msg* _msg, char* _uri, char* _hostpart, char* _res)
     if (strncasecmp(uri.s, "tel:", 4) != 0) return 1;
     
     /* reserve memory for clean tel uri */
-    tel_uri.s = pkg_malloc(uri.len);
+    tel_uri.s = pkg_malloc(uri.len+1);
     if (tel_uri.s == 0) {
 	LM_ERR("no more pkg memory\n");
 	return -1;




More information about the sr-dev mailing list