exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 952de14cd6e89e95c585ffec70938e331e92a6e0
parent e4ab7c5243209d9f64c6bfd47f22041cad46260d
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Sat, 11 Jul 2026 20:14:54 +0200

fix payto://iban/ parser to never go for a '/' after '?'

Diffstat:
Msrc/lib/exchange_api_common.c | 2+-
Msrc/lib/exchange_api_common.h | 5++++-
Msrc/util/payto.c | 21+++++++++++++++++++--
3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c @@ -300,7 +300,7 @@ TALER_EXCHANGE_check_coin_denomination_conflict_ ( &h_denom_pub)) { GNUNET_break_op (0); - return GNUNET_OK; + return GNUNET_NO; } /* indeed, proof with different denomination key provided */ return GNUNET_OK; diff --git a/src/lib/exchange_api_common.h b/src/lib/exchange_api_common.h @@ -137,7 +137,10 @@ TALER_EXCHANGE_check_coin_amount_conflict_ ( * @param proof a proof to check * @param ch_denom_pub hash of the conflicting denomination * @return #GNUNET_OK if @a ch_denom_pub differs from the - * denomination hash given by the history of the coin + * denomination hash given by the history of the coin, + * #GNUNET_NO if the proof is for the same @ch_denom_pub + * and thus invalid + * #GNUNET_SYSERR if the proof failed to parse (also invalid) */ enum GNUNET_GenericReturnValue TALER_EXCHANGE_check_coin_denomination_conflict_ ( diff --git a/src/util/payto.c b/src/util/payto.c @@ -236,6 +236,7 @@ TALER_xtalerbank_account_from_payto (const struct TALER_FullPayto payto) static char * validate_payto_iban (const char *payto_uri) { + size_t slen = strlen (payto_uri); const char *iban; const char *q; char *result; @@ -246,8 +247,24 @@ validate_payto_iban (const char *payto_uri) IBAN_PREFIX, strlen (IBAN_PREFIX))) return NULL; /* not an IBAN */ - iban = strrchr (payto_uri, - '/') + 1; + /* Find the last '/' that is part of the path, i.e. before any '?' + query part ('/' is a legal character in a query value and must + not be mistaken for the path separator). */ + { + const char *q; + const char *slash; + + q = memchr (payto_uri, + '?', + slen); + slash = memrchr (payto_uri, + '/', + (NULL == q) + ? slen + : q - payto_uri); + GNUNET_assert (NULL != slash); /* prefix guarantees a '/' */ + iban = slash + 1; + } #undef IBAN_PREFIX q = strchr (iban, '?');