diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/c-ares/test/ares-test-fuzz-name.c | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/c-ares/test/ares-test-fuzz-name.c')
-rw-r--r-- | src/c-ares/test/ares-test-fuzz-name.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/c-ares/test/ares-test-fuzz-name.c b/src/c-ares/test/ares-test-fuzz-name.c new file mode 100644 index 000000000..378da3739 --- /dev/null +++ b/src/c-ares/test/ares-test-fuzz-name.c @@ -0,0 +1,23 @@ +#include <stddef.h> +#include <stdlib.h> +#include <string.h> + +#include "ares.h" +// Include ares internal file for DNS protocol constants +#include "nameser.h" + +// Entrypoint for Clang's libfuzzer, exercising query creation. +int LLVMFuzzerTestOneInput(const unsigned char *data, + unsigned long size) { + // Null terminate the data. + char *name = malloc(size + 1); + name[size] = '\0'; + memcpy(name, data, size); + + unsigned char *buf = NULL; + int buflen = 0; + ares_create_query(name, ns_c_in, ns_t_aaaa, 1234, 0, &buf, &buflen, 1024); + free(buf); + free(name); + return 0; +} |