fix use-after-free, add log statements to report request parsing error lines more clearly
This commit is contained in:
parent
6453b72ef9
commit
d7bdcc6e67
@ -185,13 +185,17 @@ get_coin_public_info (struct MHD_Connection *connection,
|
|||||||
coin_info,
|
coin_info,
|
||||||
spec);
|
spec);
|
||||||
if (GNUNET_OK != ret)
|
if (GNUNET_OK != ret)
|
||||||
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
/* check mint signature on the coin */
|
/* check mint signature on the coin */
|
||||||
r_melt_detail->coin_info.denom_sig = sig;
|
r_melt_detail->coin_info.denom_sig = sig;
|
||||||
r_melt_detail->coin_info.denom_pub = pk;
|
r_melt_detail->coin_info.denom_pub = pk;
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_test_coin_valid (&r_melt_detail->coin_info))
|
TALER_test_coin_valid (&r_melt_detail->coin_info))
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
TMH_PARSE_release_data (spec);
|
TMH_PARSE_release_data (spec);
|
||||||
r_melt_detail->coin_info.denom_sig.rsa_signature = NULL;
|
r_melt_detail->coin_info.denom_sig.rsa_signature = NULL;
|
||||||
r_melt_detail->coin_info.denom_pub.rsa_public_key = NULL;
|
r_melt_detail->coin_info.denom_pub.rsa_public_key = NULL;
|
||||||
@ -202,7 +206,6 @@ get_coin_public_info (struct MHD_Connection *connection,
|
|||||||
}
|
}
|
||||||
r_melt_detail->melt_sig = melt_sig;
|
r_melt_detail->melt_sig = melt_sig;
|
||||||
r_melt_detail->melt_amount_with_fee = amount;
|
r_melt_detail->melt_amount_with_fee = amount;
|
||||||
TMH_PARSE_release_data (spec);
|
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,6 +260,7 @@ verify_coin_public_info (struct MHD_Connection *connection,
|
|||||||
if (TALER_amount_cmp (&fee_refresh,
|
if (TALER_amount_cmp (&fee_refresh,
|
||||||
&melt_detail->melt_amount_with_fee) < 0)
|
&melt_detail->melt_amount_with_fee) < 0)
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
TMH_KS_release (key_state);
|
TMH_KS_release (key_state);
|
||||||
return (MHD_YES ==
|
return (MHD_YES ==
|
||||||
TMH_RESPONSE_reply_external_error (connection,
|
TMH_RESPONSE_reply_external_error (connection,
|
||||||
@ -271,6 +275,7 @@ verify_coin_public_info (struct MHD_Connection *connection,
|
|||||||
&melt_detail->melt_sig.eddsa_signature,
|
&melt_detail->melt_sig.eddsa_signature,
|
||||||
&melt_detail->coin_info.coin_pub.eddsa_pub))
|
&melt_detail->coin_info.coin_pub.eddsa_pub))
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
if (MHD_YES !=
|
if (MHD_YES !=
|
||||||
TMH_RESPONSE_reply_signature_invalid (connection,
|
TMH_RESPONSE_reply_signature_invalid (connection,
|
||||||
"confirm_sig"))
|
"confirm_sig"))
|
||||||
@ -418,6 +423,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
|
|||||||
&coin_melt_details[i]);
|
&coin_melt_details[i]);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
for (j=0;j<i;j++)
|
for (j=0;j<i;j++)
|
||||||
{
|
{
|
||||||
GNUNET_CRYPTO_rsa_public_key_free (coin_melt_details[j].coin_info.denom_pub.rsa_public_key);
|
GNUNET_CRYPTO_rsa_public_key_free (coin_melt_details[j].coin_info.denom_pub.rsa_public_key);
|
||||||
@ -437,6 +443,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
|
|||||||
&coin_melt_details[j].coin_info.coin_pub,
|
&coin_melt_details[j].coin_info.coin_pub,
|
||||||
sizeof (struct TALER_CoinSpendPublicKeyP)))
|
sizeof (struct TALER_CoinSpendPublicKeyP)))
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
for (j=0;j<i;j++)
|
for (j=0;j<i;j++)
|
||||||
{
|
{
|
||||||
GNUNET_CRYPTO_rsa_public_key_free (coin_melt_details[j].coin_info.denom_pub.rsa_public_key);
|
GNUNET_CRYPTO_rsa_public_key_free (coin_melt_details[j].coin_info.denom_pub.rsa_public_key);
|
||||||
@ -458,7 +465,6 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
|
|||||||
GNUNET_CRYPTO_hash_context_read (hash_context,
|
GNUNET_CRYPTO_hash_context_read (hash_context,
|
||||||
&melt_amount,
|
&melt_amount,
|
||||||
sizeof (struct TALER_AmountNBO));
|
sizeof (struct TALER_AmountNBO));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parse JSON arrays into 2d binary arrays and hash everything
|
/* parse JSON arrays into 2d binary arrays and hash everything
|
||||||
@ -485,6 +491,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
GNUNET_CRYPTO_hash_context_abort (hash_context);
|
GNUNET_CRYPTO_hash_context_abort (hash_context);
|
||||||
free_commit_coins (commit_coin,
|
free_commit_coins (commit_coin,
|
||||||
TALER_CNC_KAPPA,
|
TALER_CNC_KAPPA,
|
||||||
@ -503,6 +510,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
|
|||||||
&link_enc_size);
|
&link_enc_size);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
GNUNET_CRYPTO_hash_context_abort (hash_context);
|
GNUNET_CRYPTO_hash_context_abort (hash_context);
|
||||||
free_commit_coins (commit_coin,
|
free_commit_coins (commit_coin,
|
||||||
TALER_CNC_KAPPA,
|
TALER_CNC_KAPPA,
|
||||||
@ -538,6 +546,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
GNUNET_break (GNUNET_SYSERR != res);
|
GNUNET_break (GNUNET_SYSERR != res);
|
||||||
GNUNET_CRYPTO_hash_context_abort (hash_context);
|
GNUNET_CRYPTO_hash_context_abort (hash_context);
|
||||||
free_commit_coins (commit_coin,
|
free_commit_coins (commit_coin,
|
||||||
@ -558,6 +567,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
GNUNET_break (GNUNET_SYSERR != res);
|
GNUNET_break (GNUNET_SYSERR != res);
|
||||||
GNUNET_CRYPTO_hash_context_abort (hash_context);
|
GNUNET_CRYPTO_hash_context_abort (hash_context);
|
||||||
free_commit_coins (commit_coin,
|
free_commit_coins (commit_coin,
|
||||||
@ -586,6 +596,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
|
|||||||
&coin_melt_details[i]);
|
&coin_melt_details[i]);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
res = (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
res = (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user