]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Skip recursive _raddict_export() call if children == NULL
authorJames Jones <jejones3141@gmail.com>
Fri, 26 May 2023 11:59:47 +0000 (06:59 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 26 May 2023 15:10:10 +0000 (11:10 -0400)
Arguably a redundant test, but the alternative would be to
model talloc_array_length() to make clear to coverity that
it returns zero if handed NULL, and we're not sure that
modeling functions can check their parameters.

src/bin/radict.c

index 6795c2fc5fbf91829ba00b790e5298ca7e202ad6..7e62071b5adf366e073a0c97a54544e3a5fa6118 100644 (file)
@@ -263,11 +263,12 @@ static void _raddict_export(fr_dict_t const *dict, uint64_t *count, uintptr_t *l
         *      Todo - Should be fixed to use attribute walking API
         */
        children = dict_attr_children(da);
-       len = talloc_array_length(children);
-       for (i = 0; i < len; i++) {
-               /* coverity[dereference] */
-               for (p = children[i]; p; p = p->next) {
-                       _raddict_export(dict, count, low, high, p, lvl + 1);
+       if (children) {
+               len = talloc_array_length(children);
+               for (i = 0; i < len; i++) {
+                       for (p = children[i]; p; p = p->next) {
+                               _raddict_export(dict, count, low, high, p, lvl + 1);
+                       }
                }
        }
 }