[PATCH 2/5] libsepol: set number of target names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Set the number of target names to 0 instead of leaving it uninitialized.
The number is always 0 since CIL does not support non-trivial not-self
neverallow rules yet.

Reported by Clang Analyzer:

    module_to_cil.c:1211:18: warning: The right operand of '<' is a garbage value [core.UndefinedBinaryOperatorResult]
     1211 |                         for (t = 0; t < num_tnames; t++) {
          |                                       ^ ~~~~~~~~~~

Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
 libsepol/src/module_to_cil.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libsepol/src/module_to_cil.c b/libsepol/src/module_to_cil.c
index d2868019..2d77e22a 100644
--- a/libsepol/src/module_to_cil.c
+++ b/libsepol/src/module_to_cil.c
@@ -1199,6 +1199,8 @@ static int avrule_list_to_cil(int indent, struct policydb *pdb, struct avrule *a
 				rc = -1;
 				goto exit;
 			}
+
+			num_tnames = 0;
 		} else {
 			ts = &avrule->ttypes;
 			rc = process_typeset(pdb, ts, attr_list, &tnames, &num_tnames);
-- 
2.42.0




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux