commit 698ade2449ed0476522cb513bc81f297405761cc parent c77fac0e6a937063b0e2b825f888bf2fdacdc66e Author: Christian Grothoff <christian@grothoff.org> Date: Mon, 13 Jul 2026 00:20:40 +0200 add sanity limit on # categories Diffstat:
| M | src/lib/merchant_api_get-private-products-PRODUCT_ID.c | | | 7 | +++++-- |
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/lib/merchant_api_get-private-products-PRODUCT_ID.c b/src/lib/merchant_api_get-private-products-PRODUCT_ID.c @@ -30,6 +30,8 @@ #include <taler/taler_json_lib.h> +#define MAX_CATEGORIES 1024 + /** * Handle for a GET /private/products/$PRODUCT_ID operation. */ @@ -201,9 +203,10 @@ handle_get_product_finished (void *cls, uint64_t *categories; num_categories = (unsigned int) json_array_size (jcategories); - if (json_array_size (jcategories) != (size_t) num_categories) + if ( (json_array_size (jcategories) != (size_t) num_categories) || + (num_categories > MAX_CATEGORIES) ) { - GNUNET_break (0); + GNUNET_break_op (0); pgr.hr.http_status = 0; pgr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break;