commit 6da14b7d3605e1fb45b70b881f917686520daa63
parent 783649591065e5f07066b2b94e59248eef19056c
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Fri, 14 Aug 2026 22:52:55 +0200
check client input, do not assert on it
Diffstat:
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_common_deposit.c b/src/exchange/taler-exchange-httpd_common_deposit.c
@@ -82,6 +82,20 @@ TEH_common_purse_deposit_parse_coin (
}
if (! coin->cpi.no_age_commitment)
{
+ if (__builtin_popcount (dk->meta.age_mask.bits) - 1 !=
+ (int) coin->age_commitment.num)
+ {
+ /* number of public keys in the commitment does not match the
+ number of age groups of the denomination */
+ GNUNET_break_op (0);
+ GNUNET_JSON_parse_free (spec);
+ return (MHD_YES ==
+ TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "age_commitment"))
+ ? GNUNET_NO : GNUNET_SYSERR;
+ }
coin->age_commitment.mask = dk->meta.age_mask;
TALER_age_commitment_hash (&coin->age_commitment,
&coin->cpi.h_age_commitment);