From 3f99b14939ec616ef59f62887e2532cd89409a3e Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Wed, 31 Oct 2018 10:10:04 -0400 Subject: [PATCH] libselinux: fix overly strict validation of file_contexts.bin load_mmap and regex_load_mmap (in the !USE_PCRE2 case) were incorrectly treating the absence of any fixed stems or study data as an error, rejecting valid file_contexts.bin files. Remove the extraneous validation checks. Test: $ cat > file_contexts < Signed-off-by: Stephen Smalley --- libselinux/src/label_file.c | 2 +- libselinux/src/regex.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c index 560d8c3d..dbf51a93 100644 --- a/libselinux/src/label_file.c +++ b/libselinux/src/label_file.c @@ -232,7 +232,7 @@ end_arch_check: /* allocate the stems_data array */ rc = next_entry(&stem_map_len, mmap_area, sizeof(uint32_t)); - if (rc < 0 || !stem_map_len) + if (rc < 0) return -1; /* diff --git a/libselinux/src/regex.c b/libselinux/src/regex.c index dfc15d63..a6fcbbfe 100644 --- a/libselinux/src/regex.c +++ b/libselinux/src/regex.c @@ -348,7 +348,7 @@ int regex_load_mmap(struct mmap_area *mmap_area, struct regex_data **regex, goto err; rc = next_entry(&entry_len, mmap_area, sizeof(uint32_t)); - if (rc < 0 || !entry_len) + if (rc < 0) goto err; if (entry_len) {