From: Arran Cudbard-Bell Date: Mon, 20 May 2024 15:59:32 +0000 (-0400) Subject: Coverity 1598300 is a false positive. The array IS terminated correctly X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89bd9217529bbd873d2c153c42d136285d57e53e;p=thirdparty%2Ffreeradius-server.git Coverity 1598300 is a false positive. The array IS terminated correctly We should likely just default to not allowing any arguments unless they're explicitly set. This commit doesn't fix anything, it just removes the call to "xlat_func_mono_set" which we should be moving away from. --- diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index 97790839ef6..f4ff9ac8a22 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -1883,10 +1883,10 @@ do { \ xlat->token = _op; \ } while (0) -#define XLAT_REGISTER_MONO(_xlat, _func, _arg, _ret_type) \ +#define XLAT_REGISTER_BOOL(_xlat, _func, _arg, _ret_type) \ do { \ if (unlikely((xlat = xlat_func_register(NULL, _xlat, _func, _ret_type)) == NULL)) return -1; \ - xlat_func_mono_set(xlat, _arg); \ + xlat_func_args_set(xlat, _arg); \ xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_INTERNAL); \ } while (0) @@ -1935,14 +1935,17 @@ int xlat_register_expressions(void) XLAT_REGISTER_NARY_OP(T_LAND, logical_and, logical); XLAT_REGISTER_NARY_OP(T_LOR, logical_or, logical); - XLAT_REGISTER_MONO("expr.rcode", xlat_func_expr_rcode, xlat_func_expr_rcode_arg, FR_TYPE_BOOL); + XLAT_REGISTER_BOOL("expr.rcode", xlat_func_expr_rcode, xlat_func_expr_rcode_arg, FR_TYPE_BOOL); xlat_func_instantiate_set(xlat, xlat_instantiate_expr_rcode, xlat_rcode_inst_t, NULL, NULL); - XLAT_REGISTER_MONO("rcode", xlat_func_rcode, xlat_func_rcode_arg, FR_TYPE_STRING); - XLAT_REGISTER_MONO("exists", xlat_func_exists, xlat_func_exists_arg, FR_TYPE_BOOL); + XLAT_REGISTER_BOOL("exists", xlat_func_exists, xlat_func_exists_arg, FR_TYPE_BOOL); xlat_func_instantiate_set(xlat, xlat_instantiate_exists, xlat_exists_inst_t, NULL, NULL); xlat_func_print_set(xlat, xlat_expr_print_exists); + if (unlikely((xlat = xlat_func_register(NULL, "rcode", xlat_func_rcode, FR_TYPE_STRING)) == NULL)) return -1; + xlat_func_args_set(xlat, xlat_func_rcode_arg); + xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_INTERNAL); + /* * -EXPR * ~EXPR