merchant

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

commit 4c57cbe8d93896185f2efd8f5d9b8df2d8b04c30
parent 3447073219bf35010a39ac1089734a4e348f805e
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 13 Jul 2026 00:31:11 +0200

handle extreme prices array cases nicely

Diffstat:
Msrc/util/product_parse.c | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/util/product_parse.c b/src/util/product_parse.c @@ -234,13 +234,21 @@ TALER_MERCHANT_parse_product_sold (const json_t *pj, GNUNET_break_op (0); return GNUNET_SYSERR; } - if (NULL != prices) + if ( (NULL != prices) && + (0 != json_array_size (prices)) ) { size_t len = json_array_size (prices); size_t i; json_t *price_i; - GNUNET_assert (len < UINT_MAX); + if (len >= UINT_MAX) + { + /* 'prices' is untrusted network input; reject rather than abort. + (The zero-length case is excluded by the guard above, so we + never call GNUNET_new_array(0, ...).) */ + GNUNET_break_op (0); + return GNUNET_SYSERR; + } r->prices_length = (unsigned int) len; r->prices = GNUNET_new_array (r->prices_length, struct TALER_Amount);