]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fr_dict_attr_by_oid() should parse the entire input string
authorAlan T. DeKok <aland@freeradius.org>
Tue, 27 Dec 2022 13:43:22 +0000 (08:43 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 27 Dec 2022 13:43:22 +0000 (08:43 -0500)
if it doesn't, then the input string contains a valid attribute,
but then ends with an invalid character, or with an unknown
attribute.

src/lib/util/dict_util.c

index b345ca5d689b2b8584af4aa5efbbfd309a6bca99..fbdb28a935f27e2fa25d3d89ee25d52f74bd0b11 100644 (file)
@@ -1961,6 +1961,15 @@ fr_dict_attr_t const *fr_dict_attr_by_oid(fr_dict_attr_err_t *err, fr_dict_attr_
        fr_dict_attr_by_oid_substr(err, &da, parent, &sbuff, NULL);
        if (err != FR_DICT_ATTR_OK) return NULL;
 
+       /*
+        *      If we didn't parse the entire string, then the parsing stopped at an unknown child.
+        *      e.g. Vendor-Specific.Cisco.Foo.  In that case, the full attribute wasn't found.
+        */
+       if (fr_sbuff_remaining(&sbuff) > 0) {
+               *err = FR_DICT_ATTR_NOTFOUND;
+               return NULL;
+       }
+
        return da;
 }