Skip to content

Commit d13d13e

Browse files
cgzonesjwcart2
authored andcommitted
libselinux/fuzz: readjust load_mmap() update
Update the fuzzers for the input number parameter addition. Signed-off-by: Christian Göttsche <[email protected]> Acked-by: James Carter <[email protected]>
1 parent e0f61d3 commit d13d13e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

libselinux/fuzz/selabel_file_compiled-fuzzer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
195195
goto cleanup;
196196

197197
errno = 0;
198-
rc = load_mmap(fp, fcontext_data1_len, &rec, MEMFD_FILE_NAME);
198+
rc = load_mmap(fp, fcontext_data1_len, &rec, MEMFD_FILE_NAME, 0);
199199
if (rc) {
200200
assert(errno != 0);
201201
goto cleanup;
@@ -208,7 +208,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
208208
goto cleanup;
209209

210210
errno = 0;
211-
rc = load_mmap(fp, fcontext_data2_len, &rec, MEMFD_FILE_NAME);
211+
rc = load_mmap(fp, fcontext_data2_len, &rec, MEMFD_FILE_NAME, 1);
212212
if (rc) {
213213
assert(errno != 0);
214214
goto cleanup;
@@ -221,7 +221,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
221221
goto cleanup;
222222

223223
errno = 0;
224-
rc = load_mmap(fp, fcontext_data3_len, &rec, MEMFD_FILE_NAME);
224+
rc = load_mmap(fp, fcontext_data3_len, &rec, MEMFD_FILE_NAME, 2);
225225
if (rc) {
226226
assert(errno != 0);
227227
goto cleanup;

libselinux/fuzz/selabel_file_text-fuzzer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
167167
goto cleanup;
168168

169169
errno = 0;
170-
rc = process_text_file(fp, /*prefix=*/ NULL, &rec, MEMFD_FILE_NAME);
170+
rc = process_text_file(fp, /*prefix=*/ NULL, &rec, MEMFD_FILE_NAME, 0);
171171
if (rc) {
172172
assert(errno != 0);
173173
goto cleanup;

libselinux/src/label_file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct lookup_result {
6060
struct lookup_result *next;
6161
};
6262
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
63-
extern int load_mmap(FILE *fp, const size_t len, struct selabel_handle *rec, const char *path);
63+
extern int load_mmap(FILE *fp, const size_t len, struct selabel_handle *rec, const char *path, uint8_t inputno);
6464
extern int process_text_file(FILE *fp, const char *prefix, struct selabel_handle *rec, const char *path, uint8_t inputno);
6565
extern void free_lookup_result(struct lookup_result *result);
6666
extern struct lookup_result *lookup_all(struct selabel_handle *rec, const char *key, int type, bool partial, bool find_all, struct lookup_result *buf);

0 commit comments

Comments
 (0)