瀏覽代碼

rls: allocate size for normalized uri for cloning buffer

- it can be longer than pres uri, when proto prefix needs to be added

(cherry picked from commit 93932a4ff18760d8fc8c59bd08984fd00cfd7759)
(cherry picked from commit 96eec5f5aaa99288ef59097cc39c6322993521ab)
Daniel-Constantin Mierla 7 年之前
父節點
當前提交
bcab1e7603
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/modules/rls/subscribe.c

+ 4 - 1
src/modules/rls/subscribe.c

@@ -985,6 +985,8 @@ int send_resource_subs(char* uri, void* param)
 				pres_uri.len, pres_uri.s);
 		return -1;
 	}
+	LM_DBG("pres uri [%.*s] - normalized uri [%.*s]\n",
+			pres_uri.len, pres_uri.s, normalized_uri->len, normalized_uri->s);
 
 	if (parse_uri(normalized_uri->s, normalized_uri->len, &parsed_pres_uri)
 			< 0) {
@@ -1016,7 +1018,8 @@ int send_resource_subs(char* uri, void* param)
 		LM_ERR("out of private memory\n");
 		return -1;
 	}
-	if ((tmp_str->s = (char *)pkg_malloc(sizeof(char) * pres_uri.len)) == NULL)
+	if ((tmp_str->s = (char *)pkg_malloc(sizeof(char)
+							* normalized_uri->len)) == NULL)
 	{
 		pkg_free(tmp_str);
 		LM_ERR("out of private memory\n");