From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 18 Nov 2026 16:01:54 +0100 Subject: [PATCH] reducer: fail when no provider mapping exists for a policy find_best_map() never fills in the best map in that case, and select_policies() read provider names from uninitialized memory. Issue: https://bugs.taler.net/n/12196 Assisted by LLM --- src/reducer/anastasis_api_backup_redux.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c index 4ef9978..1a329ef 100644 --- a/src/reducer/anastasis_api_backup_redux.c +++ b/src/reducer/anastasis_api_backup_redux.c @@ -1411,6 +1411,14 @@ select_policies (struct PolicyBuilder *pb) "Assessed %u/%u policies\n", pb->evaluations, (unsigned int) MAX_EVALUATIONS); + if (0 == pb->evaluations) + { + /* Some policy has no provider mapping at all, so + find_best_map() never filled in @e best. */ + pb->ec = TALER_EC_ANASTASIS_REDUCER_AUTHENTICATION_METHOD_NOT_SUPPORTED; + pb->hint = "no provider offers all of the selected authentication methods"; + return; + } off = 0; for (struct Policy *p = pb->p_head; NULL != p; -- 2.47.3