diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
commit | be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c | |
parent | Initial commit. (diff) | |
download | netdata-upstream.tar.xz netdata-upstream.zip |
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c')
-rw-r--r-- | fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c b/fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c new file mode 100644 index 00000000..82df7437 --- /dev/null +++ b/fluent-bit/lib/c-ares-1.19.1/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 "ares_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, C_IN, T_AAAA, 1234, 0, &buf, &buflen, 1024); + free(buf); + free(name); + return 0; +} |