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

Daniel-Constantin Mierla miconda at gmail.com
Thu May 15 15:50:16 CEST 2014


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

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

(cherry picked from commit 7992a2b8d42bb7e8bcf1738cf042013ed126a47a)
(cherry picked from commit f44415eee52d5c17a9b6c5e16175bd84455e9867)

---

 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