2
0
Эх сурвалжийг харах

modules_k/pv : Fixed a bug in pv transformation (tobody transformation), that caused a segmentation fault.

The bug was caused by a incorrect error handling of the parse_to() method (defined in parser/parse_to.c).
The function returns a char* (pointer to the last character parsed), in case of error it updates an error status.
On incorrect to params, a segmentation fault happened after some time.(Because of a double pkg_free).
Marius Zbihlei 15 жил өмнө
parent
commit
e7096bf243

+ 2 - 1
modules_k/pv/pv_trans.c

@@ -987,7 +987,8 @@ int tr_eval_tobody(struct sip_msg *msg, tr_param_t *tp, int subtype,
 		
 		/* parse params */
 		sv = _tr_tobody_str;
-		if (parse_to(sv.s, sv.s + sv.len + 2, &_tr_tobody)<0)
+		parse_to(sv.s, sv.s + sv.len + 2, &_tr_tobody);
+		if (_tr_tobody.error == PARSE_ERROR)
 		{
 			memset(&_tr_tobody, 0, sizeof(struct to_body));
 			pkg_free(_tr_tobody_str.s);