summaryrefslogtreecommitdiff
path: root/src/exchange-lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-10-06 20:02:28 +0200
committerChristian Grothoff <christian@grothoff.org>2017-10-06 20:02:28 +0200
commit2f715c27f82584cb65855785144877da628fe35c (patch)
treeaf92de489ba87850dabcac30fe56a9e8640eb4ee /src/exchange-lib
parent1da03b95eb8e13f0e4ebaa79d2096a89b34cb1b2 (diff)
downloadexchange-2f715c27f82584cb65855785144877da628fe35c.tar.gz
exchange-2f715c27f82584cb65855785144877da628fe35c.tar.bz2
exchange-2f715c27f82584cb65855785144877da628fe35c.zip
check return value from TALER_JSON_hash
Diffstat (limited to 'src/exchange-lib')
-rw-r--r--src/exchange-lib/exchange_api_deposit.c10
-rw-r--r--src/exchange-lib/exchange_api_reserve.c9
-rw-r--r--src/exchange-lib/test_exchange_api.c30
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 4937b14aa..d90b1aa75 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 4b5152c50..644a9919c 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 4c0a49e8b..70fb3ffdc 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,