aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/exchange_api_handle.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 4d1dacbb8..a09020579 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -280,17 +280,22 @@ parse_fees (const struct TALER_MasterPublicKeyP *master_pub,
unsigned int *fees_len)
{
struct TALER_EXCHANGE_WireFeesByMethod *fbm;
- unsigned int fbml = json_object_size (fees);
+ size_t fbml = json_object_size (fees);
unsigned int i = 0;
const char *key;
const json_t *fee_array;
+ if (UINT_MAX < fbml)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
fbm = GNUNET_new_array (fbml,
struct TALER_EXCHANGE_WireFeesByMethod);
- *fees_len = fbml;
+ *fees_len = (unsigned int) fbml;
json_object_foreach ((json_t *) fees, key, fee_array) {
struct TALER_EXCHANGE_WireFeesByMethod *fe = &fbm[i++];
- unsigned int idx;
+ size_t idx;
json_t *fee;
fe->method = GNUNET_strdup (key);