dfuzzer
|
#include <gio/gio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include "rand.h"
Functions | |
static void | df_rand_random_string (char *buf, const long size) |
void | df_rand_init (const long buf_size) |
guint8 | df_rand_guint8 (void) |
gboolean | df_rand_gboolean (void) |
gint16 | df_rand_gint16 (void) |
guint16 | df_rand_guint16 (void) |
gint32 | df_rand_gint32 (void) |
guint32 | df_rand_guint32 (void) |
gint64 | df_rand_gint64 (void) |
guint64 | df_rand_guint64 (void) |
double | drand (void) |
gdouble | df_rand_gdouble (void) |
int | df_rand_continue (const int fuzz_on_str_len) |
int | df_rand_string (gchar **buf) |
int | df_rand_dbus_objpath_string (gchar **buf) |
int | df_rand_dbus_signature_string (gchar **buf) |
int | df_rand_GVariant (GVariant **var) |
int | df_rand_unixFD (void) |
Variables | |
static long | df_buf_size |
static unsigned int | df_num_fuzz_counter |
static unsigned short | df_gu8f |
static unsigned short | df_gi16f |
static unsigned short | df_gu16f |
static unsigned short | df_gi32f |
static unsigned short | df_gu32f |
static unsigned short | df_gi64f |
static unsigned short | df_gu64f |
static unsigned short | df_gdouf |
static long | df_str_len |
static const char * | df_str_def [] |
static unsigned | df_index_str |
static unsigned | df_index_var |
static const char | df_sig_def [16] = "ybnqiuxtdsogavh" |
int df_rand_continue | ( | const int | fuzz_on_str_len | ) |
Tells callee whether to continue testing according to current size of generated strings not to exceed df_buf_size length.
fuzz_on_str_len | If 1, fuzzing will be controlled by generated random strings lengths |
int df_rand_dbus_objpath_string | ( | gchar ** | buf | ) |
Allocates memory for pseudo-random object path string of size counted by adding 1 to size variable on every call of function to maximum size of MAXLEN. On every call pseudo-random object path string is generated into buf buffer. Warning: buf should be freed outside this module by callee of this function.
buf | Address of pointer on buffer where generated object path string will be stored |
int df_rand_dbus_signature_string | ( | gchar ** | buf | ) |
Allocates memory for pseudo-random signature string of size counted by adding 1 to size variable on every call of function to maximum size of MAXSIG. On every call pseudo-random signature string is generated by random access into global variable df_sig_def which contains all D-Bus signatures and copying signature into buf buffer. Warning: buf should be freed outside this module by callee of this function.
buf | Address of pointer on buffer where generated signature string will be stored |
gboolean df_rand_gboolean | ( | void | ) |
gdouble df_rand_gdouble | ( | void | ) |
gint16 df_rand_gint16 | ( | void | ) |
gint32 df_rand_gint32 | ( | void | ) |
gint64 df_rand_gint64 | ( | void | ) |
guint16 df_rand_guint16 | ( | void | ) |
guint32 df_rand_guint32 | ( | void | ) |
guint64 df_rand_guint64 | ( | void | ) |
guint8 df_rand_guint8 | ( | void | ) |
int df_rand_GVariant | ( | GVariant ** | var | ) |
Creates Gvariant containing pseudo-random string. At the beginning strings from global array df_str_def are used.
var | Address of pointer on GVariant where new Gvariant value will be stored |
void df_rand_init | ( | const long | buf_size | ) |
Initializes global flag variables and seeds pseudo-random numbers generators.
buf_size | Maximum buffer size for generated strings (in Bytes) |
|
static |
Generates pseudo-random string of size size.
buf | Pointer on buffer where generated string will be stored |
size | Size of buffer |
int df_rand_string | ( | gchar ** | buf | ) |
Allocates memory for pseudo-random string of size counted by adding generated pseudo-random number from interval <0, CHAR_MAX> to df_str_len (this mechanism is responsible for generating bigger strings by every call of df_rand_string()). Then pseudo-random string is generated and stored in buf. At the beginning strings from global array df_str_def are used. Warning: buf should be freed outside this module by callee of this function.
buf | Address of pointer on buffer where generated string will be stored |
int df_rand_unixFD | ( | void | ) |
|
inline |
|
static |
Maximum buffer size for generated strings (in Bytes)
|
static |
Index into df_str_def array for function df_rand_string()
|
static |
Index into df_str_def array for function df_rand_GVariant()
|
static |
Counter for fuzzing methods which have only numbers as their parameters. Every call for some number generation increments this counter. See function df_rand_continue() how this counter is used.
|
static |
Array of signature definitions, which will be send to tested process if it has any signature parameters.
|
static |
Array of strings, which will be send to tested process if it has any string parameters. Feel free to include any strings here (only valid UTF-8). Array must be terminated by NULL string.
|
static |
Length of pseudo-random strings