From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 18 Nov 2026 17:41:26 +0100 Subject: [PATCH] json: refuse denomination age masks without the zeroth age group The age restriction code asserts that a non-empty mask has bit 0 set, and the mask comes from the exchange's /keys. Issue: https://bugs.taler.net/n/12214 Assisted by LLM --- src/json/json_helper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/json/json_helper.c b/src/json/json_helper.c index 69278c990..814deebd2 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c @@ -589,6 +589,14 @@ parse_denomination_group (void *cls, if (age_mask_missing) group->age_mask.bits = 0; + /* a non-empty age mask always marks the zeroth age group; + the age restriction code asserts this */ + if ( (0 != group->age_mask.bits) && + (0 == (group->age_mask.bits & 1)) ) + { + GNUNET_break_op (0); + return GNUNET_SYSERR; + } return GNUNET_OK; } @@ -858,6 +866,14 @@ parse_denom_pub (void *cls, if (age_mask_missing) denom_pub->age_mask.bits = 0; + /* a non-empty age mask always marks the zeroth age group; + the age restriction code asserts this */ + if ( (0 != denom_pub->age_mask.bits) && + (0 == (denom_pub->age_mask.bits & 1)) ) + { + GNUNET_break_op (0); + return GNUNET_SYSERR; + } bsign_pub = GNUNET_new (struct GNUNET_CRYPTO_BlindSignPublicKey); bsign_pub->rc = 1; bsign_pub->cipher = string_to_cipher (cipher); -- 2.47.3