[sr-dev] git:master: modules_k/textops : fix pointer return in substr transformation

Marius Zbihlei marius.zbihlei at 1and1.ro
Fri Apr 1 12:26:37 CEST 2011


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

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Fri Apr  1 13:22:05 2011 +0300

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)

---

 modules_k/textops/txt_var.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules_k/textops/txt_var.c b/modules_k/textops/txt_var.c
index ae1fce6..a13e5e1 100644
--- a/modules_k/textops/txt_var.c
+++ b/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;




More information about the sr-dev mailing list