merchant

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

commit d9da83c7896ea682afdf6b5f01eeac12146f4792
parent e8716b2ce4eea2586462fc1f78f6f214029d2be1
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Fri, 14 Aug 2026 23:28:17 +0200

bound inventory selection request

Diffstat:
Msrc/backend/taler-merchant-httpd_post-templates-TEMPLATE_ID.c | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_post-templates-TEMPLATE_ID.c b/src/backend/taler-merchant-httpd_post-templates-TEMPLATE_ID.c @@ -37,6 +37,16 @@ /** + * Maximum number of entries we accept in the @e inventory_selection + * array of a request. Each entry costs us one database round-trip + * and a full copy of the product details (including the base64-encoded + * product image), so this must be bounded independently of the maximum + * upload size. + */ +#define MAX_INVENTORY_SELECTION 1024 + + +/** * Amount the client chose for one of the choices of a paivana template. */ struct PaivanaChoiceAmount @@ -466,6 +476,15 @@ parse_using_templates_inventory_request ( return GNUNET_SYSERR; } + if (MAX_INVENTORY_SELECTION < json_array_size (inventory_selection)) + { + GNUNET_break_op (0); + use_reply_with_error (uc, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "inventory_selection (too many entries)"); + return GNUNET_SYSERR; + } for (size_t i = 0; i < json_array_size (inventory_selection); i++) { struct InventoryTemplateItemContext item = { 0 };