5 // Entrypoint for Clang's libfuzzer
6 int LLVMFuzzerTestOneInput(const unsigned char *data,
8 // Feed the data into each of the ares_parse_*_reply functions.
9 struct hostent *host = NULL;
10 struct ares_addrttl info[5];
12 ares_parse_a_reply(data, size, &host, info, &count);
13 if (host) ares_free_hostent(host);
16 struct ares_addr6ttl info6[5];
18 ares_parse_aaaa_reply(data, size, &host, info6, &count);
19 if (host) ares_free_hostent(host);
22 unsigned char addrv4[4] = {0x10, 0x20, 0x30, 0x40};
23 ares_parse_ptr_reply(data, size, addrv4, sizeof(addrv4), AF_INET, &host);
24 if (host) ares_free_hostent(host);
27 ares_parse_ns_reply(data, size, &host);
28 if (host) ares_free_hostent(host);
30 struct ares_srv_reply* srv = NULL;
31 ares_parse_srv_reply(data, size, &srv);
32 if (srv) ares_free_data(srv);
34 struct ares_mx_reply* mx = NULL;
35 ares_parse_mx_reply(data, size, &mx);
36 if (mx) ares_free_data(mx);
38 struct ares_txt_reply* txt = NULL;
39 ares_parse_txt_reply(data, size, &txt);
40 if (txt) ares_free_data(txt);
42 struct ares_soa_reply* soa = NULL;
43 ares_parse_soa_reply(data, size, &soa);
44 if (soa) ares_free_data(soa);
46 struct ares_naptr_reply* naptr = NULL;
47 ares_parse_naptr_reply(data, size, &naptr);
48 if (naptr) ares_free_data(naptr);
50 struct ares_caa_reply* caa = NULL;
51 ares_parse_caa_reply(data, size, &caa);
52 if (caa) ares_free_data(caa);