Skip to content

Commit 758b88f

Browse files
committed
Allow fuzzer access into core_cmds and core variables.
1 parent e963b4d commit 758b88f

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

cmds.h

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ struct acmd_export_ {
7474
typedef struct cmd_export_ cmd_export_t;
7575
typedef struct acmd_export_ acmd_export_t;
7676

77+
#ifdef FUZZ_BUILD
78+
extern const cmd_export_t core_cmds[];
79+
#endif
80+
7781
const cmd_export_t* find_cmd_export_t(const char* name, int flags);
7882
int check_cmd_call_params(const cmd_export_t *cmd, action_elem_t *elems, int no_params);
7983
int check_acmd_call_params(const acmd_export_t *acmd, action_elem_t *elems, int no_params);

core_cmds.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ static int w_script_trace(struct sip_msg *msg, int *log_level,
122122
pv_elem_t *fmt_string, void *info_str);
123123
static int w_is_myself(struct sip_msg *msg, str *host, int *port);
124124

125-
static const cmd_export_t core_cmds[]={
125+
#ifndef FUZZ_BUILD
126+
static
127+
#endif
128+
const cmd_export_t core_cmds[]={
126129
{"forward", (cmd_function)w_forward, {
127130
{CMD_PARAM_STR|CMD_PARAM_OPT|CMD_PARAM_FIX_NULL,
128131
fixup_forward_dest, fixup_free_destination}, {0,0,0}},

pvar.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -3855,7 +3855,10 @@ static int branch_flag_get(struct sip_msg *msg, pv_param_t *param, pv_value_t *
38553855
/**
38563856
* the table with core pseudo-variables
38573857
*/
3858-
static const pv_export_t _pv_names_table[] = {
3858+
#ifndef FUZZ_BUILD
3859+
static
3860+
#endif
3861+
const pv_export_t _pv_names_table[] = {
38593862
{str_init("avp"), PVT_AVP, pv_get_avp, pv_set_avp,
38603863
pv_parse_avp_name, pv_parse_avp_index, 0, 0},
38613864
{str_init("hdr"), PVT_HDR, pv_get_hdr, 0, pv_parse_hdr_name,

pvar.h

+4
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ typedef struct _pv_export {
226226
int iparam; /*!< parameter for the init function */
227227
} pv_export_t;
228228

229+
#ifdef FUZZ_BUILD
230+
extern const pv_export_t _pv_names_table[];
231+
#endif
232+
229233
typedef struct _pv_elem
230234
{
231235
str text;

0 commit comments

Comments
 (0)