commit 2d08d612f6802f9a369755267bf4a113cdc8d871
parent 4f2ad1051b1433974e5d598b1546202797729e31
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 1 Jan 2018 23:07:36 +0100
refuse endian conversion for invalid amounts
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/util/amount.c b/src/util/amount.c
@@ -207,6 +207,8 @@ void
TALER_amount_hton (struct TALER_AmountNBO *res,
const struct TALER_Amount *d)
{
+ GNUNET_assert (GNUNET_YES ==
+ TALER_amount_is_valid (d));
res->value = GNUNET_htonll (d->value);
res->fraction = htonl (d->fraction);
memcpy (res->currency,
@@ -230,6 +232,8 @@ TALER_amount_ntoh (struct TALER_Amount *res,
memcpy (res->currency,
dn->currency,
TALER_CURRENCY_LEN);
+ GNUNET_assert (GNUNET_YES ==
+ TALER_amount_is_valid (res));
}