diff options
| author | Christian Grothoff <christian@grothoff.org> | 2017-10-06 20:02:28 +0200 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2017-10-06 20:02:28 +0200 | 
| commit | 2f715c27f82584cb65855785144877da628fe35c (patch) | |
| tree | af92de489ba87850dabcac30fe56a9e8640eb4ee /src/exchange-lib | |
| parent | 1da03b95eb8e13f0e4ebaa79d2096a89b34cb1b2 (diff) | |
check return value from TALER_JSON_hash
Diffstat (limited to 'src/exchange-lib')
| -rw-r--r-- | src/exchange-lib/exchange_api_deposit.c | 10 | ||||
| -rw-r--r-- | src/exchange-lib/exchange_api_reserve.c | 9 | ||||
| -rw-r--r-- | src/exchange-lib/test_exchange_api.c | 30 | 
3 files changed, 32 insertions, 17 deletions
| diff --git a/src/exchange-lib/exchange_api_deposit.c b/src/exchange-lib/exchange_api_deposit.c index 4937b14a..d90b1aa7 100644 --- a/src/exchange-lib/exchange_api_deposit.c +++ b/src/exchange-lib/exchange_api_deposit.c @@ -415,9 +415,13 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,    GNUNET_assert (GNUNET_YES ==  		 MAH_handle_is_ready (exchange));    /* initialize h_wire */ -  GNUNET_assert (GNUNET_OK == -		 TALER_JSON_hash (wire_details, -				  &h_wire)); +  if (GNUNET_OK != +      TALER_JSON_hash (wire_details, +                       &h_wire)) +  { +    GNUNET_break (0); +    return NULL; +  }    key_state = TALER_EXCHANGE_get_keys (exchange);    dki = TALER_EXCHANGE_get_denomination_key (key_state,                                               denom_pub); diff --git a/src/exchange-lib/exchange_api_reserve.c b/src/exchange-lib/exchange_api_reserve.c index 4b5152c5..644a9919 100644 --- a/src/exchange-lib/exchange_api_reserve.c +++ b/src/exchange-lib/exchange_api_reserve.c @@ -354,8 +354,13 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,        }        TALER_amount_hton (&rcc.closing_amount,  			 &amount); -      TALER_JSON_hash (rhistory[off].details.close_details.receiver_account_details, -		       &rcc.h_wire); +      if (GNUNET_OK != +          TALER_JSON_hash (rhistory[off].details.close_details.receiver_account_details, +                           &rcc.h_wire)) +      { +        GNUNET_break (0); +        return GNUNET_SYSERR; +      }        rcc.wtid = rhistory[off].details.close_details.wtid;        rcc.purpose.size = htonl (sizeof (rcc));        rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED); diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c index 4c0a49e8..70fb3ffd 100644 --- a/src/exchange-lib/test_exchange_api.c +++ b/src/exchange-lib/test_exchange_api.c @@ -1709,8 +1709,9 @@ wire_deposits_cb (void *cls,          wire = json_loads (dep->details.deposit.wire_details,                             JSON_REJECT_DUPLICATES,                             NULL); -        TALER_JSON_hash (wire, -                         &hw); +        GNUNET_assert (GNUNET_OK == +                       TALER_JSON_hash (wire, +                                        &hw));          json_decref (wire);          if (0 != memcmp (&hw,                           h_wire, @@ -2261,8 +2262,9 @@ interpreter_run (void *cls)          fail (is);          return;        } -      TALER_JSON_hash (contract_terms, -                       &h_contract_terms); +      GNUNET_assert (GNUNET_OK == +                     TALER_JSON_hash (contract_terms, +                                      &h_contract_terms));        json_decref (contract_terms);        wire = json_loads (cmd->details.deposit.wire_details,                           JSON_REJECT_DUPLICATES, @@ -2307,8 +2309,9 @@ interpreter_run (void *cls)          dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS));          dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT);          dr.h_contract_terms = h_contract_terms; -        TALER_JSON_hash (wire, -                         &dr.h_wire); +        GNUNET_assert (GNUNET_OK == +                       TALER_JSON_hash (wire, +                                        &dr.h_wire));          dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);          dr.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);          TALER_amount_hton (&dr.amount_with_fee, @@ -2542,15 +2545,17 @@ interpreter_run (void *cls)                           JSON_REJECT_DUPLICATES,                           NULL);        GNUNET_assert (NULL != wire); -      TALER_JSON_hash (wire, -                       &h_wire); +      GNUNET_assert (GNUNET_OK == +                     TALER_JSON_hash (wire, +                                      &h_wire));        json_decref (wire);        contract_terms = json_loads (ref->details.deposit.contract_terms,                               JSON_REJECT_DUPLICATES,                               NULL);        GNUNET_assert (NULL != contract_terms); -      TALER_JSON_hash (contract_terms, -                       &h_contract_terms); +      GNUNET_assert (GNUNET_OK == +                     TALER_JSON_hash (contract_terms, +                                      &h_contract_terms));        json_decref (contract_terms);        cmd->details.deposit_wtid.dwh            = TALER_EXCHANGE_track_transaction (exchange, @@ -2665,8 +2670,9 @@ interpreter_run (void *cls)                               JSON_REJECT_DUPLICATES,                               NULL);        GNUNET_assert (NULL != contract_terms); -      TALER_JSON_hash (contract_terms, -                       &h_contract_terms); +      GNUNET_assert (GNUNET_OK == +                     TALER_JSON_hash (contract_terms, +                                      &h_contract_terms));        json_decref (contract_terms);        coin = find_command (is, | 
