Skip to content

Commit

Permalink
limit child allocation depth to MAX_TLV_STACK
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Oct 31, 2023
1 parent 1bca847 commit 09ff0b4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/util/dict_unknown.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ fr_dict_attr_t *fr_dict_unknown_tlv_afrom_num(TALLOC_CTX *ctx, fr_dict_attr_t co
return NULL;
}

if (parent->depth >= FR_DICT_MAX_TLV_STACK) {
fr_strerror_const("Attribute depth is too large");
return NULL;
}

return dict_attr_alloc(ctx, parent, NULL, num, FR_TYPE_TLV,
&(dict_attr_args_t){ .flags = &flags });
}
Expand Down Expand Up @@ -353,6 +358,11 @@ fr_dict_attr_t *fr_dict_unknown_attr_afrom_num(TALLOC_CTX *ctx, fr_dict_attr_t c
return NULL;
}

if (parent->depth >= FR_DICT_MAX_TLV_STACK) {
fr_strerror_const("Attribute depth is too large");
return NULL;
}

return dict_attr_alloc(ctx, parent, NULL, num, FR_TYPE_OCTETS,
&(dict_attr_args_t){ .flags = &flags });
}
Expand Down

0 comments on commit 09ff0b4

Please sign in to comment.