summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_handle.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-03-05 21:41:55 +0100
committerChristian Grothoff <christian@grothoff.org>2021-03-05 21:41:55 +0100
commitca5f0c4d6f2969bfbde9d8cb5fc7f90a95c3d712 (patch)
tree96018c9e83f98bae837c6fd27c594ce6aad2c0d7 /src/lib/exchange_api_handle.c
parent5985f73d4219fd9bbfbc640aeaca409cdf571b27 (diff)
downloadexchange-ca5f0c4d6f2969bfbde9d8cb5fc7f90a95c3d712.tar.gz
exchange-ca5f0c4d6f2969bfbde9d8cb5fc7f90a95c3d712.tar.bz2
exchange-ca5f0c4d6f2969bfbde9d8cb5fc7f90a95c3d712.zip
fix #6786: do not die on bogus URL
Diffstat (limited to 'src/lib/exchange_api_handle.c')
-rw-r--r--src/lib/exchange_api_handle.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index a9203dea..405b4641 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -1293,14 +1293,10 @@ char *
TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h,
const char *path)
{
- char *ret;
-
GNUNET_assert ('/' == path[0]);
- ret = TALER_url_join (h->url,
- path + 1,
- NULL);
- GNUNET_assert (NULL != ret);
- return ret;
+ return TALER_url_join (h->url,
+ path + 1,
+ NULL);
}
@@ -1904,6 +1900,21 @@ request_keys (void *cls)
url[strlen (url) - 1] = '\0';
kr->url = TEAH_path_to_url (exchange,
url);
+ if (NULL == kr->url)
+ {
+ struct TALER_EXCHANGE_HttpResponse hr = {
+ .ec = TALER_EC_GENERIC_CONFIGURATION_INVALID
+ };
+
+ GNUNET_free (kr);
+ exchange->keys_error_count++;
+ exchange->state = MHS_FAILED;
+ exchange->cert_cb (exchange->cert_cb_cls,
+ &hr,
+ NULL,
+ TALER_EXCHANGE_VC_PROTOCOL_ERROR);
+ return;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting keys with URL `%s'.\n",
@@ -1911,6 +1922,8 @@ request_keys (void *cls)
eh = TALER_EXCHANGE_curl_easy_get_ (kr->url);
if (NULL == eh)
{
+ GNUNET_free (kr->url);
+ GNUNET_free (kr);
exchange->retry_delay = EXCHANGE_LIB_BACKOFF (exchange->retry_delay);
exchange->retry_task = GNUNET_SCHEDULER_add_delayed (exchange->retry_delay,
&request_keys,