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; break;
} }
} }
if (0 == ret)
{
/* history is empty!? */
GNUNET_break (0);
json_decref (json_history);
return NULL;
}
if (GNUNET_SYSERR == if (GNUNET_SYSERR ==
TALER_amount_subtract (balance, TALER_amount_subtract (balance,
&deposit_total, &deposit_total,

View File

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