]> git.proxmox.com Git - ceph.git/blob - ceph/src/c-ares/test/ares-test-fuzz-name.c
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / c-ares / test / ares-test-fuzz-name.c
1 #include <stddef.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #include "ares.h"
6 // Include ares internal file for DNS protocol constants
7 #include "nameser.h"
8
9 // Entrypoint for Clang's libfuzzer, exercising query creation.
10 int LLVMFuzzerTestOneInput(const unsigned char *data,
11 unsigned long size) {
12 // Null terminate the data.
13 char *name = malloc(size + 1);
14 name[size] = '\0';
15 memcpy(name, data, size);
16
17 unsigned char *buf = NULL;
18 int buflen = 0;
19 ares_create_query(name, ns_c_in, ns_t_aaaa, 1234, 0, &buf, &buflen, 1024);
20 free(buf);
21 free(name);
22 return 0;
23 }