diff mbox series

libselinux/fuzz: readjust load_mmap() update

Message ID 20241217212752.23866-1-cgoettsche@seltendoof.de (mailing list archive)
State New
Headers show
Series libselinux/fuzz: readjust load_mmap() update | expand

Commit Message

Christian Göttsche Dec. 17, 2024, 9:27 p.m. UTC
From: Christian Göttsche <cgzones@googlemail.com>

Update the fuzzers for the input number parameter addition.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libselinux/fuzz/selabel_file_compiled-fuzzer.c | 6 +++---
 libselinux/fuzz/selabel_file_text-fuzzer.c     | 2 +-
 libselinux/src/label_file.h                    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libselinux/fuzz/selabel_file_compiled-fuzzer.c b/libselinux/fuzz/selabel_file_compiled-fuzzer.c
index d1249a76..09fbddd1 100644
--- a/libselinux/fuzz/selabel_file_compiled-fuzzer.c
+++ b/libselinux/fuzz/selabel_file_compiled-fuzzer.c
@@ -195,7 +195,7 @@  int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 		goto cleanup;
 
 	errno = 0;
-	rc = load_mmap(fp, fcontext_data1_len, &rec, MEMFD_FILE_NAME);
+	rc = load_mmap(fp, fcontext_data1_len, &rec, MEMFD_FILE_NAME, 0);
 	if (rc) {
 		assert(errno != 0);
 		goto cleanup;
@@ -208,7 +208,7 @@  int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 		goto cleanup;
 
 	errno = 0;
-	rc = load_mmap(fp, fcontext_data2_len, &rec, MEMFD_FILE_NAME);
+	rc = load_mmap(fp, fcontext_data2_len, &rec, MEMFD_FILE_NAME, 1);
 	if (rc) {
 		assert(errno != 0);
 		goto cleanup;
@@ -221,7 +221,7 @@  int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 		goto cleanup;
 
 	errno = 0;
-	rc = load_mmap(fp, fcontext_data3_len, &rec, MEMFD_FILE_NAME);
+	rc = load_mmap(fp, fcontext_data3_len, &rec, MEMFD_FILE_NAME, 2);
 	if (rc) {
 		assert(errno != 0);
 		goto cleanup;
diff --git a/libselinux/fuzz/selabel_file_text-fuzzer.c b/libselinux/fuzz/selabel_file_text-fuzzer.c
index ed67ea25..1f8942dd 100644
--- a/libselinux/fuzz/selabel_file_text-fuzzer.c
+++ b/libselinux/fuzz/selabel_file_text-fuzzer.c
@@ -167,7 +167,7 @@  int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 		goto cleanup;
 
 	errno = 0;
-	rc = process_text_file(fp, /*prefix=*/ NULL, &rec, MEMFD_FILE_NAME);
+	rc = process_text_file(fp, /*prefix=*/ NULL, &rec, MEMFD_FILE_NAME, 0);
 	if (rc) {
 		assert(errno != 0);
 		goto cleanup;
diff --git a/libselinux/src/label_file.h b/libselinux/src/label_file.h
index 597b756e..60ebbb47 100644
--- a/libselinux/src/label_file.h
+++ b/libselinux/src/label_file.h
@@ -60,7 +60,7 @@  struct lookup_result {
 	struct lookup_result *next;
 };
 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
-extern int load_mmap(FILE *fp, const size_t len, struct selabel_handle *rec, const char *path);
+extern int load_mmap(FILE *fp, const size_t len, struct selabel_handle *rec, const char *path, uint8_t inputno);
 extern int process_text_file(FILE *fp, const char *prefix, struct selabel_handle *rec, const char *path, uint8_t inputno);
 extern void free_lookup_result(struct lookup_result *result);
 extern struct lookup_result *lookup_all(struct selabel_handle *rec, const char *key, int type, bool partial, bool find_all, struct lookup_result *buf);