[Freeswitch-svn] [commit] r9217 - freeswitch/trunk/src/mod/applications/mod_expr

Freeswitch SVN anthm at freeswitch.org
Fri Aug 1 12:00:55 EDT 2008


Author: anthm
Date: Fri Aug  1 12:00:55 2008
New Revision: 9217

Modified:
   freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c

Log:
fix endless loop in mod_expr

Modified: freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c	Fri Aug  1 12:00:55 2008
@@ -52,6 +52,7 @@
 	char val[512] = "", *p;
 	char *m_cmd = NULL;
 	size_t len;
+	int ec = 0;
 
 	if (switch_strlen_zero(cmd)) {
 		goto error;
@@ -126,7 +127,16 @@
 
 	do {
 		err = exprEval(e, &last_expr);
-	} while (err);
+		if (err) {
+			ec++;
+		} else {
+			ec = 0;
+		}
+	} while (err && ec < 3);
+
+	if (err) {
+		goto error;
+	}
 
 	switch_snprintf(val, sizeof(val), "%0.10f", last_expr);
 	for (p = (val + strlen(val) - 1); p != val; p--) {



More information about the Freeswitch-svn mailing list