]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fr_dict_attr_by_oid() first check if the 'err' is valid (#4830)
authorJorge Pereira <jpereira@users.noreply.github.com>
Tue, 27 Dec 2022 13:52:17 +0000 (10:52 -0300)
committerGitHub <noreply@github.com>
Tue, 27 Dec 2022 13:52:17 +0000 (08:52 -0500)
src/lib/util/dict_util.c

index fbdb28a935f27e2fa25d3d89ee25d52f74bd0b11..642ed558521329de43f60f807e4e169a29bd5843 100644 (file)
@@ -1959,14 +1959,14 @@ fr_dict_attr_t const *fr_dict_attr_by_oid(fr_dict_attr_err_t *err, fr_dict_attr_
        fr_dict_attr_t const    *da;
 
        fr_dict_attr_by_oid_substr(err, &da, parent, &sbuff, NULL);
-       if (err != FR_DICT_ATTR_OK) return NULL;
+       if (err && *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;
+               if (err) *err = FR_DICT_ATTR_NOTFOUND;
                return NULL;
        }