/src/mosquitto/fuzzing/libcommon/libcommon_fuzz_topic_matching.cpp
Line | Count | Source |
1 | | #include "src/libfuzzer/libfuzzer_macro.h" |
2 | | |
3 | | #include "libcommon_fuzz_topic_matching.pb.h" |
4 | | #include "mosquitto.h" |
5 | | |
6 | | DEFINE_PROTO_FUZZER(const fuzz_topic_matches_sub::FuzzerInput& fuzzer_input) |
7 | 846 | { |
8 | 846 | bool result; |
9 | 846 | const char *string1 = fuzzer_input.string1().c_str(); |
10 | 846 | const char *string2 = fuzzer_input.string2().c_str(); |
11 | 846 | const char *username = nullptr; |
12 | 846 | const char *clientid = nullptr; |
13 | | |
14 | 846 | if(fuzzer_input.has_username()){ |
15 | 53 | username = fuzzer_input.username().c_str(); |
16 | 53 | } |
17 | 846 | if(fuzzer_input.has_clientid()){ |
18 | 80 | clientid = fuzzer_input.clientid().c_str(); |
19 | 80 | } |
20 | | |
21 | | //targeted_function_1(fuzzer_input.arg1(), fuzzer_input.arg2(), fuzzer_input.arg3()); |
22 | 846 | mosquitto_topic_matches_sub(string1, string2, &result); |
23 | 846 | mosquitto_topic_matches_sub2(string1, strlen(string1), string2, strlen(string2), &result); |
24 | 846 | mosquitto_topic_matches_sub_with_pattern(string1, string2, clientid, username, &result); |
25 | | |
26 | 846 | mosquitto_sub_matches_acl(string1, string2, &result); |
27 | 846 | mosquitto_sub_matches_acl_with_pattern(string1, string2, clientid, username, &result); |
28 | 846 | } |