"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/ares-test-fuzz-name.c" between
c-ares-1.17.1.tar.gz and c-ares-1.17.2.tar.gz

About: c-ares is a C library for asynchronous DNS requests (including name resolves).

ares-test-fuzz-name.c  (c-ares-1.17.1):ares-test-fuzz-name.c  (c-ares-1.17.2)
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "ares.h" #include "ares.h"
// Include ares internal file for DNS protocol constants // Include ares internal file for DNS protocol constants
#include "nameser.h" #include "ares_nameser.h"
// Entrypoint for Clang's libfuzzer, exercising query creation. // Entrypoint for Clang's libfuzzer, exercising query creation.
int LLVMFuzzerTestOneInput(const unsigned char *data, int LLVMFuzzerTestOneInput(const unsigned char *data,
unsigned long size) { unsigned long size) {
// Null terminate the data. // Null terminate the data.
char *name = malloc(size + 1); char *name = malloc(size + 1);
name[size] = '\0'; name[size] = '\0';
memcpy(name, data, size); memcpy(name, data, size);
unsigned char *buf = NULL; unsigned char *buf = NULL;
int buflen = 0; int buflen = 0;
ares_create_query(name, ns_c_in, ns_t_aaaa, 1234, 0, &buf, &buflen, 1024); ares_create_query(name, C_IN, T_AAAA, 1234, 0, &buf, &buflen, 1024);
free(buf); free(buf);
free(name); free(name);
return 0; return 0;
} }
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)