From: Arran Cudbard-Bell Date: Sat, 17 Feb 2024 22:00:33 +0000 (-0600) Subject: Fix issues with uri_escape X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90a42ec9389bbf67581d806a25ec20a2b4a6f219;p=thirdparty%2Ffreeradius-server.git Fix issues with uri_escape --- diff --git a/src/lib/curl/xlat.c b/src/lib/curl/xlat.c index 63f79b23d54..b31ce06f356 100644 --- a/src/lib/curl/xlat.c +++ b/src/lib/curl/xlat.c @@ -47,25 +47,23 @@ xlat_action_t fr_curl_xlat_uri_escape(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_ char *escaped; escaped = curl_easy_escape(fr_curl_tmp_handle(), to_escape->vb_strvalue, to_escape->vb_length); - if (!escaped) return -1; + if (!escaped) return XLAT_ACTION_FAIL; /* * Returned string the same length - nothing changed */ - if (strlen(escaped) == to_escape->vb_length) { - curl_free(escaped); - return 0; - } + if (strlen(escaped) == to_escape->vb_length) goto done; fr_value_box_clear_value(to_escape); fr_value_box_strdup(to_escape, to_escape, NULL, escaped, to_escape->tainted); +done: curl_free(escaped); fr_value_box_list_remove(in, to_escape); fr_dcursor_insert(out, to_escape); - return XLAT_ACTION_FAIL; + return XLAT_ACTION_DONE; } /** xlat function to unescape URI encoded strings