瀏覽代碼

Make sure to call parse_headers(HDR_EOH_F) in the replace() and
replace_all(). Otherwise, if replacement happens in the body the
associated lump can end up in the list of header lumps, not in the
body lumps, which can lead to bad things if the message is also
then process by the nathelper or similar SDP-rewriting modules.

Sponsored by: Sippy Software, Inc.
Debugging: mpatrol

Maxim Sobolev 17 年之前
父節點
當前提交
6ac5f8995d
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      modules_s/textops/textops.c

+ 6 - 0
modules_s/textops/textops.c

@@ -363,6 +363,9 @@ static int replace_all_f(struct sip_msg* msg, char* key, char* _str)
 	int ret;
 	int eflags;
 
+	/* we need to be sure we have seen all HFs */
+	parse_headers(msg, HDR_EOH_F, 0);
+
 	begin=get_header(msg); /* msg->orig previously .. uri problems */
 	ret=-1; /* pessimist: we will not find any */
 	eflags=0; /* match ^ at the beginning of the string*/
@@ -409,6 +412,9 @@ static int replace_f(struct sip_msg* msg, char* key, char* _str)
 	char* begin;
 	int off;
 
+	/* we need to be sure we have seen all HFs */
+	parse_headers(msg, HDR_EOH_F, 0);
+
 	begin=get_header(msg); /* msg->orig previously .. uri problems */
 
 	if (regexec(((fparam_t*)key)->v.regex, begin, 1, &pmatch, 0)!=0) return -1;