43RCSID(
"$Id: 8f24196d07b27777f324a3119890ff1dbf9c4488 $")
45#include <freeradius-devel/fuzzer/common.h>
46#include <freeradius-devel/server/base.h>
47#include <freeradius-devel/server/tmpl.h>
48#include <freeradius-devel/unlang/base.h>
108#define POISON_START 64
116#define MODE_SUBSTR_BARE 0
117#define MODE_SUBSTR_DOUBLE 1
118#define MODE_SUBSTR_SINGLE 2
119#define MODE_SUBSTR_BACK 3
120#define MODE_ATTR_STR 4
136 if (size < 2)
return 0;
137 if (size > 4096)
return 0;
156 if (!raw_fmt)
goto done;
158 if (fmt_len) memcpy(
fmt,
data + 1, fmt_len);
174 .allow_unresolved =
false,
175 .allow_unknown =
false,
176 .allow_wildcard =
true,
225 if (slen <= 0 || !
vpt)
goto done;
249 char print_buf[1024];
static int const char * fmt
int fuzzer_common_init(int *argc, char ***argv, bool load_proto)
Perform all bootstrapping for the fuzzer.
#define fr_exit_now(_x)
Exit without calling atexit() handlers, producing a log message in debug builds.
#define MODE_SUBSTR_DOUBLE
#define MODE_SUBSTR_SINGLE
int LLVMFuzzerInitialize(int *argc, char ***argv)
static tmpl_res_rules_t tr_rules
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
int unlang_global_init(void)
#define ASAN_POISON_MEMORY_REGION(_start, _size)
#define ASAN_UNPOISON_MEMORY_REGION(_start, _size)
fr_slen_t tmpl_print(fr_sbuff_t *out, tmpl_t const *vpt, fr_sbuff_escape_rules_t const *e_rules)
fr_dict_attr_t const * request_attr_request
int request_global_init(void)
#define FR_SBUFF_IN(_start, _len_or_end)
#define FR_SBUFF_OUT(_start, _len_or_end)
int tmpl_resolve(tmpl_t *vpt, tmpl_res_rules_t const *tr_rules))
Attempt to resolve functions and attributes in xlats and attribute references.
ssize_t tmpl_afrom_attr_str(TALLOC_CTX *ctx, tmpl_attr_error_t *err, tmpl_t **out, char const *name, tmpl_rules_t const *rules))
Parse a string into a TMPL_TYPE_ATTR_* type tmpl_t.
ssize_t tmpl_afrom_substr(TALLOC_CTX *ctx, tmpl_t **out, fr_sbuff_t *in, fr_token_t quote, fr_sbuff_parse_rules_t const *p_rules, tmpl_rules_t const *t_rules))
Convert an arbitrary string into a tmpl_t.
int tmpl_global_init(void)
fr_dict_t const * dict_def
Alternative default dictionary to use if vpt->rules->dict_def is NULL.
@ TMPL_ATTR_ERROR_NONE
No error.
tmpl_attr_rules_t attr
Rules/data for parsing attribute references.
struct tmpl_res_rules_s tmpl_res_rules_t
struct tmpl_rules_s tmpl_rules_t
struct tmpl_attr_rules_s tmpl_attr_rules_t
Similar to tmpl_rules_t, but used to specify parameters that may change during subsequent resolution ...
Optional arguments passed to vp_tmpl functions.
fr_dict_t const * dict_def
Default dictionary to use with unqualified attribute references.
static TALLOC_CTX * talloc_init_const(char const *name)
Allocate a top level chunk with a constant name.
void fr_perror(char const *fmt,...)
Print the current error to stderr with a prefix.
void fr_strerror_clear(void)
Clears all pending messages from the talloc pools.
int fr_check_lib_magic(uint64_t magic)
Check if the application linking to the library has the correct magic number.
#define RADIUSD_MAGIC_NUMBER