]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
We don't need the length passed to dict_fixup_clone
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 23 Oct 2024 05:18:53 +0000 (23:18 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 24 Oct 2024 23:07:54 +0000 (17:07 -0600)
src/lib/util/dict_fixup.c
src/lib/util/dict_fixup_priv.h
src/lib/util/dict_tokenize.c

index 7c97ae970e70a8f1bd632aa0f5694b6a668d3288..c90c8068139db68fc62db03a375aa5291c72d6dc 100644 (file)
@@ -81,7 +81,6 @@ typedef struct {
        fr_dict_attr_t          *da;                    //!< FR_TYPE_VSA to fix
 } dict_fixup_vsa_t;
 
-
 /** Dictionary attribute namespaces need their hash tables finalised
  *
  */
@@ -384,15 +383,14 @@ static inline CC_HINT(always_inline) int dict_fixup_group_apply(UNUSED dict_fixu
  * @param[in] line             this fixup relates to.
  * @param[in] parent           for the cloned attribute.
  * @param[in] da               The group dictionary attribute.
- * @param[in] ref              OID string representing what the group references.
- * @param[in] ref_len          Length of the reference string.
+ * @param[in] ref              OID string representing what the group references..
  * @return
  *     - 0 on success.
  *     - -1 on out of memory.
  */
 int dict_fixup_clone(dict_fixup_ctx_t *fctx, char const *filename, int line,
                     fr_dict_attr_t *parent, fr_dict_attr_t *da,
-                    char const *ref, size_t ref_len)
+                    char const *ref)
 {
        dict_fixup_clone_t *fixup;
 
@@ -410,7 +408,7 @@ int dict_fixup_clone(dict_fixup_ctx_t *fctx, char const *filename, int line,
        *fixup = (dict_fixup_clone_t) {
                .parent = parent,
                .da = da,
-               .ref = talloc_bstrndup(fixup, ref, ref_len)
+               .ref = talloc_typed_strdup(fixup, ref)
        };
 
        return dict_fixup_common(filename, line, &fctx->clone, &fixup->common);
index 4d3d1250e5081d51642ed58412fc6fc8c5095f58..562f169b4bc3b4abbca7aa85c1a3557b3d299f85 100644 (file)
@@ -49,7 +49,7 @@ int   dict_fixup_group(dict_fixup_ctx_t *fctx, char const *filename, int line,
 
 int    dict_fixup_clone(dict_fixup_ctx_t *fctx, char const *filename, int line,
                         fr_dict_attr_t *parent, fr_dict_attr_t *da,
-                        char const *ref, size_t ref_len);
+                        char const *ref);
 
 int    dict_fixup_vsa(dict_fixup_ctx_t *fctx, char const *filename, int line,
                         fr_dict_attr_t *da);
index e9c9333604eeb1debf8f6ef17555c6b4d59020a3..0d5b1f58f50e89463baf94e3ae1e80eeba19cd10 100644 (file)
@@ -788,7 +788,7 @@ static int dict_process_ref(dict_tokenize_ctx_t *ctx, fr_dict_attr_t const *pare
 
                if (dict_fixup_clone(&ctx->fixup, CURRENT_FRAME(ctx)->filename, CURRENT_FRAME(ctx)->line,
                                     fr_dict_attr_unconst(parent), fr_dict_attr_unconst(da),
-                                    ref, talloc_array_length(ref) - 1) < 0) {
+                                    ref) < 0) {
                fail:
                        talloc_free(ref);
                        return -1;
@@ -1471,7 +1471,7 @@ static int dict_read_process_member(dict_tokenize_ctx_t *ctx, char **argv, int a
                ret = dict_fixup_clone(&ctx->fixup, CURRENT_FRAME(ctx)->filename, CURRENT_FRAME(ctx)->line,
                                       fr_dict_attr_unconst(CURRENT_FRAME(ctx)->da),
                                       dict_attr_child_by_num(CURRENT_FRAME(ctx)->da, CURRENT_FRAME(ctx)->member_num),
-                                      ref, talloc_array_length(ref) - 1);
+                                      ref);
                talloc_free(ref);
 
                if (ret < 0) return -1;