From: Arran Cudbard-Bell Date: Wed, 23 Oct 2024 05:18:53 +0000 (-0600) Subject: We don't need the length passed to dict_fixup_clone X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcc47860dced3d4d386a290dd18ff9343cf6846c;p=thirdparty%2Ffreeradius-server.git We don't need the length passed to dict_fixup_clone --- diff --git a/src/lib/util/dict_fixup.c b/src/lib/util/dict_fixup.c index 7c97ae970e7..c90c8068139 100644 --- a/src/lib/util/dict_fixup.c +++ b/src/lib/util/dict_fixup.c @@ -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); diff --git a/src/lib/util/dict_fixup_priv.h b/src/lib/util/dict_fixup_priv.h index 4d3d1250e50..562f169b4bc 100644 --- a/src/lib/util/dict_fixup_priv.h +++ b/src/lib/util/dict_fixup_priv.h @@ -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); diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index e9c9333604e..0d5b1f58f50 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -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;