浏览代码

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

- reported by Juha Heinanen
Daniel-Constantin Mierla 11 年之前
父节点
当前提交
7992a2b8d4
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      modules/siputils/checks.c

+ 1 - 1
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;