From: Jorge Pereira Date: Tue, 27 Dec 2022 13:52:17 +0000 (-0300) Subject: fr_dict_attr_by_oid() first check if the 'err' is valid (#4830) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38a181e6ea71a38ff90fa3a1c20e2be4098323fb;p=thirdparty%2Ffreeradius-server.git fr_dict_attr_by_oid() first check if the 'err' is valid (#4830) --- diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index fbdb28a935f..642ed558521 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -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; }