merchant

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

commit fd0800e5b15299a317e6c88901ad26bf8cb4de68
parent f8ca1f2c1d4a4de1f40e4f638885b64a906a95b8
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 12 Jul 2026 23:52:51 +0200

fail on empty price array

Diffstat:
Msrc/backend/taler-merchant-httpd_patch-private-products-PRODUCT_ID.c | 10++++++++++
Msrc/backend/taler-merchant-httpd_post-private-products.c | 10++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_patch-private-products-PRODUCT_ID.c b/src/backend/taler-merchant-httpd_patch-private-products-PRODUCT_ID.c @@ -165,6 +165,16 @@ TMH_private_patch_products_ID ( if (NULL == pd.product_name) pd.product_name = pd.description; } + if ( (! unit_price_missing) && + (0 == pd.price_array_length) ) + { + GNUNET_break_op (0); + ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "unit_price"); + goto cleanup; + } if (! unit_price_missing) { if (! price_missing) diff --git a/src/backend/taler-merchant-httpd_post-private-products.c b/src/backend/taler-merchant-httpd_post-private-products.c @@ -155,6 +155,16 @@ TMH_private_post_products (const struct TMH_RequestHandler *rh, if (NULL == pd.product_name) pd.product_name = pd.description; + if ( (! unit_price_missing) && + (0 == pd.price_array_length) ) + { + GNUNET_break_op (0); + ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "unit_price"); + goto cleanup; + } if (! unit_price_missing) { if (! price_missing)