diff --git a/.github/workflows/mayhem.yml b/.github/workflows/mayhem.yml index c4bda3af..7325365a 100644 --- a/.github/workflows/mayhem.yml +++ b/.github/workflows/mayhem.yml @@ -59,7 +59,8 @@ jobs: fail-fast: false matrix: mayhemfile: - - mayhem/Mayhemfile + - mayhem/user.Mayhemfile + - mayhem/group.Mayhemfile steps: - uses: actions/checkout@v3 diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 47b669c2..c348c80b 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -15,5 +15,9 @@ honggfuzz = "0.5.55" members = ["."] [[bin]] -name = "target" -path = "fuzz_targets/target.rs" \ No newline at end of file +name = "group_to_gid" +path = "fuzz_targets/group_to_gid.rs" + +[[bin]] +name = "user_to_uid" +path = "fuzz_targets/user_to_uid.rs" \ No newline at end of file diff --git a/fuzz/fuzz_targets/group_to_gid.rs b/fuzz/fuzz_targets/group_to_gid.rs new file mode 100644 index 00000000..ea5e56bd --- /dev/null +++ b/fuzz/fuzz_targets/group_to_gid.rs @@ -0,0 +1,17 @@ +use honggfuzz::fuzz; +use rppal::pwm::sysfs::user_to_uid; + +fn main() { + // Define the fuzzing loop + loop { + // Fuzzing input will be provided by Honggfuzz + fuzz!(|data: &[u8]| { + // Convert the input to a string + if let Ok(name) = std::str::from_utf8(data) { + // Call the user_to_uid function with the fuzzed input + let _ = group_to_gid(name); + + } + }); + } +} diff --git a/fuzz/fuzz_targets/target.rs b/fuzz/fuzz_targets/user_to_uid.rs similarity index 100% rename from fuzz/fuzz_targets/target.rs rename to fuzz/fuzz_targets/user_to_uid.rs diff --git a/mayhem/Dockerfile b/mayhem/Dockerfile index 36de168e..418dcfc1 100644 --- a/mayhem/Dockerfile +++ b/mayhem/Dockerfile @@ -18,4 +18,5 @@ RUN cd ./fuzz && cargo +nightly hfuzz build # Move Fuzzers to a clean image FROM ubuntu:20.04 -COPY --from=builder rppal/fuzz/hfuzz_target/x86_64-unknown-linux-gnu/release/target / \ No newline at end of file +COPY --from=builder rppal/fuzz/hfuzz_target/x86_64-unknown-linux-gnu/release/user_to_uid / +COPY --from=builder rppal/fuzz/hfuzz_target/x86_64-unknown-linux-gnu/release/group_to_gid / \ No newline at end of file diff --git a/mayhem/Mayhemfile b/mayhem/Mayhemfile deleted file mode 100644 index 9a737076..00000000 --- a/mayhem/Mayhemfile +++ /dev/null @@ -1,5 +0,0 @@ -project: rppal -target: target - -cmds: - - cmd: /target \ No newline at end of file diff --git a/mayhem/group.Mayhemfile b/mayhem/group.Mayhemfile new file mode 100644 index 00000000..3bc59f7f --- /dev/null +++ b/mayhem/group.Mayhemfile @@ -0,0 +1,5 @@ +project: rppal +group_to_gid: group_to_gid + +cmds: + - cmd: /group_to_gid \ No newline at end of file diff --git a/mayhem/user.Mayhemfile b/mayhem/user.Mayhemfile new file mode 100644 index 00000000..2526a762 --- /dev/null +++ b/mayhem/user.Mayhemfile @@ -0,0 +1,5 @@ +project: rppal +user_to_uid: user_to_uid + +cmds: + - cmd: /user_to_uid \ No newline at end of file