Debian Codegraph @

fuzzing/libcommon/libcommon_fuzz_topic_matching.cpp

raw
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 {
8 bool result;
9 const char *string1 = fuzzer_input.string1().c_str();
10 const char *string2 = fuzzer_input.string2().c_str();
11 const char *username = nullptr;
12 const char *clientid = nullptr;
13
14 if(fuzzer_input.has_username()){
15 username = fuzzer_input.username().c_str();
16 }
17 if(fuzzer_input.has_clientid()){
18 clientid = fuzzer_input.clientid().c_str();
19 }
20
21 //targeted_function_1(fuzzer_input.arg1(), fuzzer_input.arg2(), fuzzer_input.arg3());
22 mosquitto_topic_matches_sub(string1, string2, &result);
23 mosquitto_topic_matches_sub2(string1, strlen(string1), string2, strlen(string2), &result);
24 mosquitto_topic_matches_sub_with_pattern(string1, string2, clientid, username, &result);
25
26 mosquitto_sub_matches_acl(string1, string2, &result);
27 mosquitto_sub_matches_acl_with_pattern(string1, string2, clientid, username, &result);
28 }