summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-26 19:25:35 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-26 19:25:35 +0100
commite63d3121314c7238930c55d40673640e327f964c (patch)
treefbda65b5fc727f8708c1275672826e5760072908 /src/lib
parent8fa6b996ed70bc4079b1b4f6b34bcda58a4094bd (diff)
downloadexchange-e63d3121314c7238930c55d40673640e327f964c.tar.gz
exchange-e63d3121314c7238930c55d40673640e327f964c.tar.bz2
exchange-e63d3121314c7238930c55d40673640e327f964c.zip
do not crash on odd inputs
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/exchange_api_deposit.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 8c00effcf..4ef76c886 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -148,7 +148,11 @@ auditor_cb (void *cls,
key_state = TALER_EXCHANGE_get_keys (dh->exchange);
spk = TALER_EXCHANGE_get_signing_key_info (key_state,
&dh->exchange_pub);
- GNUNET_assert (NULL != spk);
+ if (NULL == spk)
+ {
+ GNUNET_break_op (0);
+ return NULL;
+ }
TALER_amount_ntoh (&amount_without_fee,
&dh->depconf.amount_without_fee);
aie = GNUNET_new (struct TEAH_AuditorInteractionEntry);
@@ -544,7 +548,11 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
}
(void) GNUNET_TIME_round_abs (&wire_deadline);
(void) GNUNET_TIME_round_abs (&refund_deadline);
- GNUNET_assert (refund_deadline.abs_value_us <= wire_deadline.abs_value_us);
+ if (refund_deadline.abs_value_us > wire_deadline.abs_value_us)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
GNUNET_assert (GNUNET_YES ==
TEAH_handle_is_ready (exchange));
/* initialize h_wire */
@@ -558,11 +566,19 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
key_state = TALER_EXCHANGE_get_keys (exchange);
dki = TALER_EXCHANGE_get_denomination_key (key_state,
denom_pub);
- GNUNET_assert (NULL != dki);
- GNUNET_assert (GNUNET_SYSERR !=
- TALER_amount_subtract (&amount_without_fee,
- amount,
- &dki->fee_deposit));
+ if (NULL == dki)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ if (GNUNET_SYSERR ==
+ TALER_amount_subtract (&amount_without_fee,
+ amount,
+ &dki->fee_deposit))
+ {
+ GNUNET_break_op (0);
+ return NULL;
+ }
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
&denom_pub_hash);
if (GNUNET_OK !=