Skip to content

Commit

Permalink
libsepol/fuzz: silence secilc-fuzzer
Browse files Browse the repository at this point in the history
Do not output CIL log messages while fuzzing, since their amount are
huge, e.g. for neverallow or typebounds violations.

Signed-off-by: Christian Göttsche <[email protected]>
  • Loading branch information
cgzones authored and jwcart2 committed Dec 15, 2021
1 parent bf5ff1a commit e0ba116
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libsepol/fuzz/secilc-fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include <sepol/cil/cil.h>
#include <sepol/policydb.h>

static void log_handler(__attribute__((unused)) int lvl, __attribute__((unused)) const char *msg) {
/* be quiet */
}

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
enum cil_log_level log_level = CIL_ERR;
struct sepol_policy_file *pf = NULL;
Expand All @@ -24,6 +28,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
sepol_policydb_t *pdb = NULL;

cil_set_log_level(log_level);
cil_set_log_handler(log_handler);

cil_db_init(&db);
cil_set_disable_dontaudit(db, disable_dontaudit);
Expand Down

0 comments on commit e0ba116

Please sign in to comment.