Commit Graph

4 Commits

Author SHA1 Message Date
Christian Göttsche
c8a5aa74fc libselinux/fuzz: handle inputs with trailing data
Handle the case where either separated trailing input is empty or non-
existent by initializing the size to 0 and only call related code on
non-zero size.

Fixes: 8997f543 ("libselinux: add selabel_file(5) fuzzer")
Reported-by: oss-fuzz (issue 388319478)
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
2025-01-15 20:51:57 +01:00
Christian Göttsche
d13d13eaee libselinux/fuzz: readjust load_mmap() update
Update the fuzzers for the input number parameter addition.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
2025-01-06 10:06:44 -05:00
Christian Göttsche
6c8f6390bc libselinux/fuzz: update for lookup_all() change
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@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
2024-12-17 14:54:53 -05:00
Christian Göttsche
8997f54322 libselinux: add selabel_file(5) fuzzer
Add two fuzzers reading and performing lookup on selabel_file(5)
databases.  One fuzzer takes input in form of a textual fcontext
definition, the other one takes compiled fcontexts definitions.  The
lookup key and whether to lookup any or a specific file type is also
part of the generated input.

CC: Evgeny Vereshchagin <evverx@gmail.com>
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
2024-11-15 13:59:07 -05:00