summaryrefslogtreecommitdiff
path: root/src/mint/mint_db.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-18 18:56:48 +0100
committerChristian Grothoff <christian@grothoff.org>2015-03-18 18:56:48 +0100
commit6ba63aab8472aefe85f4b96dd7bab895a46a0889 (patch)
tree7be04f8b4efcc50d95dfb6451f3aa2180339a4c1 /src/mint/mint_db.c
parent1f3f4ed8dd292f1aad0b2ca59dc9c669cafb19e4 (diff)
downloadexchange-6ba63aab8472aefe85f4b96dd7bab895a46a0889.tar.gz
exchange-6ba63aab8472aefe85f4b96dd7bab895a46a0889.tar.bz2
exchange-6ba63aab8472aefe85f4b96dd7bab895a46a0889.zip
fix #3716: make sure amount-API offers proper checks against overflow and other issues
Diffstat (limited to 'src/mint/mint_db.c')
-rw-r--r--src/mint/mint_db.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mint/mint_db.c b/src/mint/mint_db.c
index 556d32af2..6832cdac9 100644
--- a/src/mint/mint_db.c
+++ b/src/mint/mint_db.c
@@ -1092,7 +1092,11 @@ TALER_MINT_DB_insert_collectable_blindcoin (PGconn *db_conn,
if (GNUNET_OK != TALER_MINT_DB_reserve_get (db_conn,
&reserve))
goto rollback;
- reserve.balance = TALER_amount_subtract (reserve.balance, withdraw);
+ if (GNUNET_SYSERR ==
+ TALER_amount_subtract (&reserve.balance,
+ &reserve.balance,
+ &withdraw))
+ goto rollback;
if (GNUNET_OK != reserves_update (db_conn, &reserve))
goto rollback;
if (GNUNET_OK == TALER_MINT_DB_commit (db_conn))