From: Alan T. DeKok Date: Mon, 21 Mar 2022 15:44:56 +0000 (-0400) Subject: don't allow wrong lengths for protocol X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e3141f17d74f958fda4e0be5fe8b4abd5d5f65a;p=thirdparty%2Ffreeradius-server.git don't allow wrong lengths for protocol --- diff --git a/src/protocols/dhcpv4/base.c b/src/protocols/dhcpv4/base.c index 5a7561fb4d5..56a962767eb 100644 --- a/src/protocols/dhcpv4/base.c +++ b/src/protocols/dhcpv4/base.c @@ -767,6 +767,11 @@ static bool attr_valid(UNUSED fr_dict_t *dict, UNUSED fr_dict_attr_t const *pare } } + if (flags->extra && (flags->subtype == FLAG_LENGTH_UINT16)) { + fr_strerror_const("The 'length=uint16' flag cannot be used for DHCPv4"); + return false; + } + /* * "extra" signifies that subtype is being used by the * dictionaries itself. diff --git a/src/protocols/dhcpv6/base.c b/src/protocols/dhcpv6/base.c index d809e791492..4a9fe6b9e28 100644 --- a/src/protocols/dhcpv6/base.c +++ b/src/protocols/dhcpv6/base.c @@ -1033,6 +1033,11 @@ static bool attr_valid(UNUSED fr_dict_t *dict, UNUSED fr_dict_attr_t const *pare } } + if (flags->extra && (flags->subtype == FLAG_LENGTH_UINT8)) { + fr_strerror_const("The 'length=uint8' flag cannot be used for DHCPv6"); + return false; + } + /* * "extra" signifies that subtype is being used by the * dictionaries itself.