]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use fr_value_box_strdup_shallow_replace for escaped value replacement
authorNick Porter <nick@portercomputing.co.uk>
Tue, 1 Apr 2025 16:52:45 +0000 (17:52 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 1 Apr 2025 16:52:45 +0000 (17:52 +0100)
To avoid the box being re-initialised

src/modules/rlm_rest/rlm_rest.c

index 3a74dbec5c571749c6d68b23183d2a0c0dc5c8fc..b759b2fece8f5a76dac9dee42e596a6301f7dda3 100644 (file)
@@ -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);