merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 22645c27e6f3a0db600d0c89ff47b74e63540063
parent f2c05486df2f4768876f970b68e01a970a67bf99
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri,  9 Oct 2026 23:51:44 +0200

bound serial_ids as required for DB/JSON when parsing inputs

Diffstat:
Msrc/backend/taler-merchant-httpd_patch-private-otp-devices-DEVICE_ID.c | 10++++++++++
Msrc/backend/taler-merchant-httpd_post-private-otp-devices.c | 11+++++++++++
Msrc/util/base_terms_parse.c | 6++++++
Msrc/util/product_parse.c | 12++++++++++++
4 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_patch-private-otp-devices-DEVICE_ID.c b/src/backend/taler-merchant-httpd_patch-private-otp-devices-DEVICE_ID.c @@ -86,6 +86,16 @@ TMH_private_patch_otp_devices_ID (const struct TMH_RequestHandler *rh, ? MHD_YES : MHD_NO; } + /* returned to (JavaScript) clients as a JSON number, so it must be + a "SafeUint64" (2^53 - 1), see api-common.rst */ + if (tp.otp_ctr > (1LLU << 53) - 1) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "otp_ctr"); + } switch (tp.otp_algorithm) { diff --git a/src/backend/taler-merchant-httpd_post-private-otp-devices.c b/src/backend/taler-merchant-httpd_post-private-otp-devices.c @@ -117,6 +117,17 @@ TMH_private_post_otp_devices (const struct TMH_RequestHandler *rh, : MHD_NO; } } + /* returned to (JavaScript) clients as a JSON number, so it must be + a "SafeUint64" (2^53 - 1), see api-common.rst */ + if (tp.otp_ctr > (1LLU << 53) - 1) + { + GNUNET_break_op (0); + ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "otp_ctr"); + goto cleanup; + } switch (tp.otp_algorithm) { diff --git a/src/util/base_terms_parse.c b/src/util/base_terms_parse.c @@ -117,6 +117,12 @@ TALER_MERCHANT_base_terms_parse ( ename); goto cleanup; } + /* money pots are identified by their BIGINT serial */ + if (ct->default_money_pot > (uint64_t) INT64_MAX) + { + GNUNET_break_op (0); + goto cleanup; + } return ct; cleanup: diff --git a/src/util/product_parse.c b/src/util/product_parse.c @@ -202,8 +202,20 @@ TALER_MERCHANT_parse_product_sold (const json_t *pj, ename); return GNUNET_SYSERR; } + /* money pots are identified by their BIGINT serial */ + if (r->product_money_pot > (uint64_t) INT64_MAX) + { + GNUNET_break_op (0); + return GNUNET_SYSERR; + } if (! no_quantity) { + /* same range as "unit_quantity", see parse_unit_quantity() */ + if (legacy_quantity > (uint64_t) INT64_MAX) + { + GNUNET_break_op (0); + return GNUNET_SYSERR; + } r->unit_quantity.integer = legacy_quantity; r->unit_quantity.fractional = 0; }