Browse code

- eval_expr too many expressions bug (reported by Michal), fixed by removing the expr. recursions checks (they were a parser debugging remainder, you can't have expr. loops without having actions loops and the actions loops are already handled). Closes SER-91.

Andrei Pelinescu-Onciul authored on 30/01/2006 13:09:40
Showing 1 changed files
... ...
@@ -42,6 +42,7 @@
42 42
  *  2004-10-19  added from_uri & to_uri (andrei)
43 43
  *  2005-12-12  added retcode support (anrei)
44 44
  *  2005-12-19  select framework (mma)
45
+ *  2006-01-30 removed rec. protection from eval_expr (andrei)
45 46
  */
46 47
 
47 48
 
... ...
@@ -701,7 +702,7 @@ error_op:
701 702
 
702 703
 
703 704
 /* returns: 0/1 (false/true) or -1 on error */
704
-static int eval_elem(struct expr* e, struct sip_msg* msg)
705
+inline static int eval_elem(struct expr* e, struct sip_msg* msg)
705 706
 {
706 707
 	struct sip_uri uri;
707 708
 	int ret;
... ...
@@ -917,17 +918,8 @@ error:
917 918
 /* ret= 0/1 (true/false) ,  -1 on error */
918 919
 int eval_expr(struct expr* e, struct sip_msg* msg)
919 920
 {
920
-	static int rec_lev=0;
921 921
 	int ret;
922 922
 
923
-	rec_lev++;
924
-	if (rec_lev>MAX_REC_LEV){
925
-		LOG(L_CRIT, "ERROR: eval_expr: too many expressions (%d)\n",
926
-				rec_lev);
927
-		ret=-1;
928
-		goto skip;
929
-	}
930
-
931 923
 	if (e->type==ELEM_T){
932 924
 		ret=eval_elem(e, msg);
933 925
 	}else if (e->type==EXP_T){
... ...
@@ -957,9 +949,6 @@ int eval_expr(struct expr* e, struct sip_msg* msg)
957 949
 		LOG(L_CRIT, "BUG: eval_expr: unknown type %d\n", e->type);
958 950
 		ret=-1;
959 951
 	}
960
-
961
-skip:
962
-	rec_lev--;
963 952
 	return ret;
964 953
 }
965 954