diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-07-21 18:51:05 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-07-21 18:51:05 +0200 |
commit | 5828dfad1df1ff9c4f2cec18a9a85c87f7364930 (patch) | |
tree | 078f1f13310b32eff941d4bb7caf5fda2f352a8f /src/exchange/taler-exchange-httpd_keys.c | |
parent | 3721780f16f61727e0f29505a32c4aa43b53ed51 (diff) | |
download | exchange-5828dfad1df1ff9c4f2cec18a9a85c87f7364930.tar.gz exchange-5828dfad1df1ff9c4f2cec18a9a85c87f7364930.tar.bz2 exchange-5828dfad1df1ff9c4f2cec18a9a85c87f7364930.zip |
fix NPE on key not found
Diffstat (limited to 'src/exchange/taler-exchange-httpd_keys.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_keys.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index b703b2209..f6894a2a8 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -2152,7 +2152,7 @@ TEH_keys_get_handler (const struct TEH_RequestHandler *rh, * @param[in,out] meta denomination type data to complete * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue load_fees (const char *section_name, struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta) { @@ -2271,14 +2271,14 @@ load_fees (const char *section_name, } -int +enum GNUNET_GenericReturnValue TEH_keys_load_fees (const struct GNUNET_HashCode *h_denom_pub, struct TALER_DenominationPublicKey *denom_pub, struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta) { struct TEH_KeyStateHandle *ksh; struct HelperDenomination *hd; - int ok; + enum GNUNET_GenericReturnValue ok; ksh = get_key_state (true); if (NULL == ksh) @@ -2289,6 +2289,13 @@ TEH_keys_load_fees (const struct GNUNET_HashCode *h_denom_pub, hd = GNUNET_CONTAINER_multihashmap_get (ksh->helpers->denom_keys, h_denom_pub); + if (NULL == hd) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Denomination %s not known\n", + GNUNET_h2s (h_denom_pub)); + return GNUNET_NO; + } meta->start = hd->start_time; meta->expire_withdraw = GNUNET_TIME_absolute_add (meta->start, hd->validity_duration); @@ -2298,8 +2305,7 @@ TEH_keys_load_fees (const struct GNUNET_HashCode *h_denom_pub, denom_pub->rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (hd->denom_pub.rsa_public_key); else - denom_pub->rsa_public_key - = NULL; + denom_pub->rsa_public_key = NULL; return ok; } |