From 867d046df4bb84d48b4311e8f3c592c5d49f313a Mon Sep 17 00:00:00 2001 From: Nick Porter Date: Fri, 10 Jan 2025 09:33:03 +0000 Subject: [PATCH] Pop box from list before manipulation fr_value_box_strdup re-initialises the box, which clears the list pointers, meaning list_remove won't work. --- src/lib/curl/xlat.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/lib/curl/xlat.c b/src/lib/curl/xlat.c index 2e5866c1ca..84a4fcc4aa 100644 --- a/src/lib/curl/xlat.c +++ b/src/lib/curl/xlat.c @@ -46,7 +46,7 @@ xlat_action_t fr_curl_xlat_uri_escape(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in) { - fr_value_box_t *to_escape = fr_value_box_list_head(in); + fr_value_box_t *to_escape = fr_value_box_list_pop_head(in); char *escaped; escaped = curl_easy_escape(fr_curl_tmp_handle(), to_escape->vb_strvalue, to_escape->vb_length); @@ -62,8 +62,6 @@ xlat_action_t fr_curl_xlat_uri_escape(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, done: curl_free(escaped); - - fr_value_box_list_remove(in, to_escape); fr_dcursor_insert(out, to_escape); return XLAT_ACTION_DONE; @@ -76,12 +74,10 @@ xlat_action_t fr_curl_xlat_uri_unescape(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *ou UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in) { - fr_value_box_t *to_unescape = fr_value_box_list_head(in); + fr_value_box_t *to_unescape = fr_value_box_list_pop_head(in); int unescaped_len; char *unescaped; - fr_value_box_list_remove(in, to_unescape); - unescaped = curl_easy_unescape(fr_curl_tmp_handle(), to_unescape->vb_strvalue, to_unescape->vb_length, &unescaped_len); if (!unescaped) { talloc_free(to_unescape); -- 2.47.3