@@ -2066,6 +2066,7 @@ static fr_slen_t tokenize_unary(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuf
2066
2066
static xlat_exp_t * expr_cast_alloc (TALLOC_CTX * ctx , fr_type_t type , xlat_exp_t * child )
2067
2067
{
2068
2068
xlat_exp_t * cast , * node ;
2069
+ char const * str ;
2069
2070
2070
2071
/*
2071
2072
* Create a "cast" node. The first argument is a UINT8 value-box of the cast type. The RHS is
@@ -2083,11 +2084,11 @@ static xlat_exp_t *expr_cast_alloc(TALLOC_CTX *ctx, fr_type_t type, xlat_exp_t *
2083
2084
* to print the name of the type, and not the
2084
2085
* number.
2085
2086
*/
2087
+ str = fr_type_to_str (type );
2088
+ fr_assert (str != NULL );
2089
+
2086
2090
MEM (node = xlat_exp_alloc (cast , XLAT_BOX , NULL , 0 ));
2087
- {
2088
- char const * type_name = fr_table_str_by_value (fr_type_table , type , "<INVALID>" );
2089
- xlat_exp_set_name (node , type_name , strlen (type_name ));
2090
- }
2091
+ xlat_exp_set_name (node , str , strlen (str ));
2091
2092
2092
2093
fr_value_box_init (& node -> data , FR_TYPE_UINT8 , attr_cast_base , false);
2093
2094
node -> data .vb_uint8 = type ;
@@ -2247,7 +2248,7 @@ static ssize_t tokenize_rcode(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuff_
2247
2248
if (!fr_sbuff_is_terminal (& our_in , terminals )) {
2248
2249
if (!fr_dict_attr_allowed_chars [fr_sbuff_char (& our_in , '\0' )]) {
2249
2250
fr_strerror_const ("Unexpected text after return code" );
2250
- return - slen ;
2251
+ FR_SBUFF_ERROR_RETURN ( & our_in ) ;
2251
2252
}
2252
2253
return 0 ;
2253
2254
}
@@ -2394,11 +2395,12 @@ static fr_slen_t tokenize_field(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuf
2394
2395
* Peek for rcodes.
2395
2396
*/
2396
2397
slen = tokenize_rcode (head , & node , & our_in , p_rules -> terminals );
2397
- if (slen < 0 ) {
2398
- fr_sbuff_advance (& our_in , - slen );
2399
- FR_SBUFF_ERROR_RETURN (& our_in );
2398
+ if (slen < 0 ) FR_SBUFF_ERROR_RETURN (& our_in );
2399
+
2400
+ if (slen > 0 ) {
2401
+ fr_assert (node != NULL );
2402
+ goto done ;
2400
2403
}
2401
- if (slen > 0 ) goto done ;
2402
2404
FALL_THROUGH ;
2403
2405
2404
2406
default :
0 commit comments