NOTE: the right operator MUST be number to do the numeric comparison.
... | ... |
@@ -73,7 +73,7 @@ |
73 | 73 |
#include "select.h" |
74 | 74 |
#include "onsend.h" |
75 | 75 |
#include "hashes.h" |
76 |
- |
|
76 |
+#include "ut.h" |
|
77 | 77 |
|
78 | 78 |
#define RT_HASH_SIZE 8 /* route names hash */ |
79 | 79 |
|
... | ... |
@@ -584,7 +584,8 @@ inline static int comp_str(int op, str* left, int rtype, union exp_op* r, struct |
584 | 584 |
int ret; |
585 | 585 |
char backup; |
586 | 586 |
regex_t* re; |
587 |
- |
|
587 |
+ unsigned int l; |
|
588 |
+ |
|
588 | 589 |
right=0; /* warning fix */ |
589 | 590 |
|
590 | 591 |
if (rtype == AVP_ST) { |
... | ... |
@@ -599,6 +600,14 @@ inline static int comp_str(int op, str* left, int rtype, union exp_op* r, struct |
599 | 600 |
} else if ((op == MATCH_OP && rtype == RE_ST)) { |
600 | 601 |
} else if (op != MATCH_OP && rtype == STRING_ST) { |
601 | 602 |
right = &r->str; |
603 |
+ } else if (rtype == NUMBER_ST) { |
|
604 |
+ /* "123" > 100 is not allowed by cfg.y rules |
|
605 |
+ * but can happen as @select or $avp evaluation |
|
606 |
+ * $test > 10 |
|
607 |
+ * the right operator MUST be number to do the conversion |
|
608 |
+ */ |
|
609 |
+ str2int(left,&l); |
|
610 |
+ return comp_num(op, l, rtype, r); |
|
602 | 611 |
} else { |
603 | 612 |
LOG(L_CRIT, "BUG: comp_str: Bad type %d, " |
604 | 613 |
"string or RE expected\n", rtype); |