From: Alan T. DeKok Date: Sun, 5 Dec 2021 14:32:23 +0000 (-0500) Subject: more / better compile-time casting X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b28c148dccbf688dac367327b2e4767a8d76f2e;p=thirdparty%2Ffreeradius-server.git more / better compile-time casting --- diff --git a/src/lib/server/cond_tokenize.c b/src/lib/server/cond_tokenize.c index 4ece2a3763e..a0e67d08392 100644 --- a/src/lib/server/cond_tokenize.c +++ b/src/lib/server/cond_tokenize.c @@ -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; diff --git a/src/tests/keywords/integer-overflow-error.ignore b/src/tests/keywords/integer-overflow-error similarity index 100% rename from src/tests/keywords/integer-overflow-error.ignore rename to src/tests/keywords/integer-overflow-error