diff options
author | Seonah Moon <seonah1.moon@samsung.com> | 2020-12-23 13:49:24 +0900 |
---|---|---|
committer | Seonah Moon <seonah1.moon@samsung.com> | 2020-12-23 13:49:24 +0900 |
commit | 14960bfff614547ff397e455217e26d0e3419d57 (patch) | |
tree | 37a66189331b8387139ca266e8a87ada3d30529c /test/ares-test-fuzz-name.c | |
parent | f5ca34c39b5fb01031e93619b573907cc46b1a4a (diff) | |
parent | bff27be9aa171a5afc25df79cd652337aa1ecbb0 (diff) | |
download | c-ares-14960bfff614547ff397e455217e26d0e3419d57.tar.gz c-ares-14960bfff614547ff397e455217e26d0e3419d57.tar.bz2 c-ares-14960bfff614547ff397e455217e26d0e3419d57.zip |
Upgrade to 1.17.1
Change-Id: I9c889de812fe62ff3a408efb6adfd98e1bb77bf0
Diffstat (limited to 'test/ares-test-fuzz-name.c')
-rw-r--r-- | test/ares-test-fuzz-name.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ares-test-fuzz-name.c b/test/ares-test-fuzz-name.c new file mode 100644 index 0000000..378da37 --- /dev/null +++ b/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; +} |