From 2d08d612f6802f9a369755267bf4a113cdc8d871 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 1 Jan 2018 23:07:36 +0100 Subject: refuse endian conversion for invalid amounts --- src/util/amount.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/util') diff --git a/src/util/amount.c b/src/util/amount.c index 7765c74bb..20d064243 100644 --- 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)); } -- cgit v1.2.3