On Fri, Dec 6, 2024 at 3:40 PM James Carter <jwcart2@xxxxxxxxx> wrote: > > On Thu, Dec 5, 2024 at 2:40 PM Christian Göttsche > <cgoettsche@xxxxxxxxxxxxx> wrote: > > > > From: Christian Göttsche <cgzones@xxxxxxxxxxxxxx> > > > > Commit 89dd0b23 ("libselinux: avoid memory allocation in common file > > label lookup") added an additional parameter to lookup_all() for an > > optional buffer the return value might be placed into. Update the > > fuzzing related code accordingly. > > > > Fixes: 89dd0b23 ("libselinux: avoid memory allocation in common file label lookup") > > Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx> > > Acked-by: James Carter <jwcart2@xxxxxxxxx> > Merged. Thanks, Jim > > --- > > libselinux/fuzz/selabel_file_compiled-fuzzer.c | 2 +- > > libselinux/fuzz/selabel_file_text-fuzzer.c | 2 +- > > libselinux/src/label_file.h | 2 +- > > 3 files changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/libselinux/fuzz/selabel_file_compiled-fuzzer.c b/libselinux/fuzz/selabel_file_compiled-fuzzer.c > > index cf0710ad..d1249a76 100644 > > --- a/libselinux/fuzz/selabel_file_compiled-fuzzer.c > > +++ b/libselinux/fuzz/selabel_file_compiled-fuzzer.c > > @@ -232,7 +232,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) > > assert(cmp(&rec, &rec) == SELABEL_EQUAL); > > > > errno = 0; > > - result = lookup_all(&rec, key, mode, partial, find_all); > > + result = lookup_all(&rec, key, mode, partial, find_all, NULL); > > > > if (!result) > > assert(errno != 0); > > diff --git a/libselinux/fuzz/selabel_file_text-fuzzer.c b/libselinux/fuzz/selabel_file_text-fuzzer.c > > index 5d851de1..ed67ea25 100644 > > --- a/libselinux/fuzz/selabel_file_text-fuzzer.c > > +++ b/libselinux/fuzz/selabel_file_text-fuzzer.c > > @@ -178,7 +178,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) > > assert(cmp(&rec, &rec) == SELABEL_EQUAL); > > > > errno = 0; > > - result = lookup_all(&rec, key, mode, partial, find_all); > > + result = lookup_all(&rec, key, mode, partial, find_all, NULL); > > > > if (!result) > > assert(errno != 0); > > diff --git a/libselinux/src/label_file.h b/libselinux/src/label_file.h > > index c7fe3a48..562c3da6 100644 > > --- a/libselinux/src/label_file.h > > +++ b/libselinux/src/label_file.h > > @@ -63,7 +63,7 @@ struct lookup_result { > > extern int load_mmap(FILE *fp, const size_t len, struct selabel_handle *rec, const char *path); > > extern int process_text_file(FILE *fp, const char *prefix, struct selabel_handle *rec, const char *path); > > 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); > > +extern struct lookup_result *lookup_all(struct selabel_handle *rec, const char *key, int type, bool partial, bool find_all, struct lookup_result *buf); > > extern enum selabel_cmp_result cmp(const struct selabel_handle *h1, const struct selabel_handle *h2); > > #endif /* FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */ > > > > -- > > 2.45.2 > > > >