minor bugfixes

This commit is contained in:
Christian Grothoff 2015-05-01 09:59:18 +02:00
parent e591651937
commit 95f99d32dd
2 changed files with 17 additions and 11 deletions

View File

@ -548,7 +548,13 @@ compile_reserve_history (const struct TALER_MINTDB_ReserveHistory *rh,
break;
}
}
if (0 == ret)
{
/* history is empty!? */
GNUNET_break (0);
json_decref (json_history);
return NULL;
}
if (GNUNET_SYSERR ==
TALER_amount_subtract (balance,
&deposit_total,

View File

@ -290,7 +290,7 @@ TALER_refresh_link_encrypted_decode (const char *buf,
{
struct TALER_RefreshLinkEncrypted *rle;
if (buf_len < sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))
if (buf_len < sizeof (union TALER_CoinSpendPrivateKeyP))
return NULL;
if (buf_len >= GNUNET_MAX_MALLOC_CHECKED)
{
@ -298,9 +298,9 @@ TALER_refresh_link_encrypted_decode (const char *buf,
return NULL;
}
rle = GNUNET_malloc (sizeof (struct TALER_RefreshLinkEncrypted) +
buf_len - sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
buf_len - sizeof (union TALER_CoinSpendPrivateKeyP));
rle->blinding_key_enc = (const char *) &rle[1];
rle->blinding_key_enc_size = buf_len - sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
rle->blinding_key_enc_size = buf_len - sizeof (union TALER_CoinSpendPrivateKeyP);
memcpy (rle->coin_priv_enc,
buf,
buf_len);
@ -321,12 +321,12 @@ TALER_refresh_link_encrypted_encode (const struct TALER_RefreshLinkEncrypted *rl
{
char *buf;
if (rle->blinding_key_enc_size >= GNUNET_MAX_MALLOC_CHECKED - sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))
if (rle->blinding_key_enc_size >= GNUNET_MAX_MALLOC_CHECKED - sizeof (union TALER_CoinSpendPrivateKeyP))
{
GNUNET_break (0);
return NULL;
}
*buf_len = sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) + rle->blinding_key_enc_size;
*buf_len = sizeof (union TALER_CoinSpendPrivateKeyP) + rle->blinding_key_enc_size;
buf = GNUNET_malloc (*buf_len);
memcpy (buf,
rle->coin_priv_enc,