]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't allow wrong lengths for protocol
authorAlan T. DeKok <aland@freeradius.org>
Mon, 21 Mar 2022 15:44:56 +0000 (11:44 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 21 Mar 2022 15:44:56 +0000 (11:44 -0400)
src/protocols/dhcpv4/base.c
src/protocols/dhcpv6/base.c

index 5a7561fb4d58642db0b16e29ab4917233b2cd709..56a962767eb20385cf22bf0db8b2dd408d67c6cf 100644 (file)
@@ -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.
index d809e791492c478482f197ede88f62be5c9f3b14..4a9fe6b9e28b8a5856404ef0f5a32da34b069404 100644 (file)
@@ -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.