From: Nick Porter Date: Tue, 1 Apr 2025 16:52:45 +0000 (+0100) Subject: Use fr_value_box_strdup_shallow_replace for escaped value replacement X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f79a1a28c76be05e8314d9f5df51cedf107d05a;p=thirdparty%2Ffreeradius-server.git Use fr_value_box_strdup_shallow_replace for escaped value replacement To avoid the box being re-initialised --- diff --git a/src/modules/rlm_rest/rlm_rest.c b/src/modules/rlm_rest/rlm_rest.c index 3a74dbec5c5..b759b2fece8 100644 --- a/src/modules/rlm_rest/rlm_rest.c +++ b/src/modules/rlm_rest/rlm_rest.c @@ -373,7 +373,7 @@ static void *rest_uri_part_escape_uctx_alloc(UNUSED request_t *request, void con */ static int rest_uri_part_escape(fr_value_box_t *vb, UNUSED void *uctx) { - char *escaped; + char *escaped, *str; escaped = curl_easy_escape(fr_curl_tmp_handle(), vb->vb_strvalue, vb->vb_length); if (!escaped) return -1; @@ -386,8 +386,8 @@ static int rest_uri_part_escape(fr_value_box_t *vb, UNUSED void *uctx) return 0; } - fr_value_box_clear_value(vb); - fr_value_box_strdup(vb, vb, NULL, escaped, vb->tainted); + str = talloc_typed_strdup(vb, escaped); + fr_value_box_strdup_shallow_replace(vb, str, strlen(str)); curl_free(escaped);