]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
more / better compile-time casting
authorAlan T. DeKok <aland@freeradius.org>
Sun, 5 Dec 2021 14:32:23 +0000 (09:32 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 5 Dec 2021 14:32:23 +0000 (09:32 -0500)
src/lib/server/cond_tokenize.c
src/tests/keywords/integer-overflow-error [moved from src/tests/keywords/integer-overflow-error.ignore with 100% similarity]

index 4ece2a3763e8569e6a25cdd0fdbb81701da163ef..a0e67d0839293c78a762e293057b56acf3430650 100644 (file)
@@ -383,6 +383,14 @@ int fr_cond_promote_types(fr_cond_t *c, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs
        } else if (tmpl_is_data(c->data.map->rhs)) {
                rhs_type = tmpl_value_type(c->data.map->rhs);
 
+               /*
+                *      If we have ATTR op DATA, then ensure that the
+                *      data type we choose is the one from the
+                *      attribute, because that's what limits the
+                *      range of the RHS data.
+                */
+               if (fr_type_is_numeric(lhs_type) && tmpl_is_attr(c->data.map->lhs)) rhs_type = lhs_type;
+
        } else if (tmpl_is_attr(c->data.map->rhs)) {
                rhs_type = tmpl_da(c->data.map->rhs)->type;