summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:18 +0000
commit5da14042f70711ea5cf66e034699730335462f66 (patch)
tree0f6354ccac934ed87a2d555f45be4c831cf92f4a /src/fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c
parentReleasing debian version 1.44.3-2. (diff)
downloadnetdata-5da14042f70711ea5cf66e034699730335462f66.tar.xz
netdata-5da14042f70711ea5cf66e034699730335462f66.zip
Merging upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c')
-rw-r--r--src/fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c b/src/fluent-bit/lib/c-ares-1.19.1/test/ares-test-fuzz-name.c
new file mode 100644
index 000000000..82df74370
--- /dev/null
+++ b/src/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;
+}