From 59e057b93e65c73dc3cd57dcced563847d85ba77 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 20 Jul 2023 02:15:58 +0200 Subject: -misc fixes --- src/lib/exchange_api_handle.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/lib/exchange_api_handle.c') diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index 0ad2f7a3..016f7bf6 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -422,6 +422,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, const json_t *keys; json_t *key; unsigned int off; + unsigned int pos; const char *auditor_url; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("auditor_pub", @@ -450,7 +451,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, auditor->denom_keys = GNUNET_new_array (json_array_size (keys), struct TALER_EXCHANGE_AuditorDenominationInfo); - + pos = 0; json_array_foreach (keys, off, key) { struct TALER_AuditorSignatureP auditor_sig; struct TALER_DenominationHashP denom_h; @@ -509,10 +510,11 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, return GNUNET_SYSERR; } } - auditor->denom_keys[off].denom_key_offset = dk_off; - auditor->denom_keys[off].auditor_sig = auditor_sig; + auditor->denom_keys[pos].denom_key_offset = dk_off; + auditor->denom_keys[pos].auditor_sig = auditor_sig; + pos++; } - auditor->num_denom_keys = off; + auditor->num_denom_keys = pos; return GNUNET_OK; } @@ -2042,6 +2044,7 @@ TALER_EXCHANGE_keys_to_json (const struct TALER_EXCHANGE_Keys *kd) &kd->denom_keys[adi->denom_key_offset]; json_t *k; + GNUNET_assert (adi->denom_key_offset < kd->num_denom_keys); if (GNUNET_TIME_timestamp_cmp (now, >, dk->expire_deposit)) -- cgit v1.2.3