From: Alan T. DeKok Date: Sun, 1 Mar 2026 14:42:26 +0000 (-0500) Subject: use value-box API rather than hand-rolled code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b2f37db85d4ee99edd283a22af76eea283070be;p=thirdparty%2Ffreeradius-server.git use value-box API rather than hand-rolled code --- diff --git a/src/modules/rlm_ftp/rlm_ftp.c b/src/modules/rlm_ftp/rlm_ftp.c index d84a2925c6c..a273fd5791a 100644 --- a/src/modules/rlm_ftp/rlm_ftp.c +++ b/src/modules/rlm_ftp/rlm_ftp.c @@ -124,22 +124,21 @@ global_lib_autoinst_t const * const rlm_ftp_lib[] = { */ static int ftp_uri_part_escape(fr_value_box_t *vb, UNUSED void *uctx) { - char *escaped, *str; + char *escaped; + size_t len; escaped = curl_easy_escape(fr_curl_tmp_handle(), vb->vb_strvalue, vb->vb_length); if (!escaped) return -1; + len = strlen(escaped); + /* * Returned string the same length - nothing changed */ - if (strlen(escaped) == vb->vb_length) { - curl_free(escaped); - return 0; + if (len != vb->vb_length) { + MEM(fr_value_box_bstrndup(vb, vb, NULL, escaped, len, false) >= 0); } - str = talloc_strdup(vb, escaped); - fr_value_box_strdup_shallow_replace(vb, str, strlen(str)); - curl_free(escaped); return 0;