Skip to content

Commit

Permalink
libselinux/fuzz: readjust load_mmap() update
Browse files Browse the repository at this point in the history
Update the fuzzers for the input number parameter addition.

Signed-off-by: Christian Göttsche <[email protected]>
Acked-by: James Carter <[email protected]>
  • Loading branch information
cgzones authored and jwcart2 committed Jan 7, 2025
1 parent e0f61d3 commit fb2c7bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libselinux/fuzz/selabel_file_compiled-fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libselinux/fuzz/selabel_file_text-fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libselinux/src/label_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fb2c7bd

Please sign in to comment.