瀏覽代碼

modules_k/textops : fix pointer return in substr transformation

Replace a local buffer with a static one, as a pointer to it was returned outside of the function
Credits go to Timo Teräs for spotting the bug
(cherry picked from commit 87f995b66b1f58f9f85b604ba1214412819c9417)
Marius Zbihlei 14 年之前
父節點
當前提交
a3bb95fcaf
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      modules_k/textops/txt_var.c

+ 1 - 1
modules_k/textops/txt_var.c

@@ -41,7 +41,7 @@ int tr_txt_eval_re(struct sip_msg *msg, tr_param_t *tp, int subtype,
 	int nmatches;
 	str* result;
 #define TR_TXT_BUF_SIZE	2048
-	char tr_txt_buf[TR_TXT_BUF_SIZE];
+	static char tr_txt_buf[TR_TXT_BUF_SIZE];
 
 	if(val==NULL || (!(val->flags&PV_VAL_STR)) || val->rs.len<=0)
 		return -1;