Przeglądaj źródła

Bug 750625 - Fix Coverity (11095) Explicit null dereferenced

https://bugzilla.redhat.com/show_bug.cgi?id=750625

lib/libaccess/lasdns.cpp (LASDnsEval)

Bug Description: LASDnsBuild could fail and context->Table could
be left as NULL. Error checking for LASDnsBuild should be added.

Fix Description: If LASDnsBuild returns LAS_EVAL_INVALID, return
LAS_EVAL_FAIL there.
Noriko Hosoi 14 lat temu
rodzic
commit
bc9d890f48
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      lib/libaccess/lasdns.cpp

+ 7 - 1
lib/libaccess/lasdns.cpp

@@ -389,7 +389,13 @@ int LASDnsEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
                 return LAS_EVAL_FAIL;
             }
             context->Table = NULL;
-            LASDnsBuild(errp, attr_pattern, context, aliasflg);
+            if (LASDnsBuild(errp, attr_pattern, context, aliasflg) ==
+                                                            LAS_EVAL_INVALID) {
+                /* Error is already printed in LASDnsBuild */
+                ACL_CritExit();
+                return LAS_EVAL_FAIL;
+            }
+            /* After this line, it is assured context->Table is not NULL. */
         } else {
             context = (LASDnsContext *) *LAS_cookie;
         }