refuse endian conversion for invalid amounts
This commit is contained in:
parent
4f2ad1051b
commit
2d08d612f6
@ -207,6 +207,8 @@ void
|
|||||||
TALER_amount_hton (struct TALER_AmountNBO *res,
|
TALER_amount_hton (struct TALER_AmountNBO *res,
|
||||||
const struct TALER_Amount *d)
|
const struct TALER_Amount *d)
|
||||||
{
|
{
|
||||||
|
GNUNET_assert (GNUNET_YES ==
|
||||||
|
TALER_amount_is_valid (d));
|
||||||
res->value = GNUNET_htonll (d->value);
|
res->value = GNUNET_htonll (d->value);
|
||||||
res->fraction = htonl (d->fraction);
|
res->fraction = htonl (d->fraction);
|
||||||
memcpy (res->currency,
|
memcpy (res->currency,
|
||||||
@ -230,6 +232,8 @@ TALER_amount_ntoh (struct TALER_Amount *res,
|
|||||||
memcpy (res->currency,
|
memcpy (res->currency,
|
||||||
dn->currency,
|
dn->currency,
|
||||||
TALER_CURRENCY_LEN);
|
TALER_CURRENCY_LEN);
|
||||||
|
GNUNET_assert (GNUNET_YES ==
|
||||||
|
TALER_amount_is_valid (res));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user