Commit df5ea5b8 by kevin-haynie Committed by Victor M. Alvarez

Added max_match_data to set_config (#121)

parent b9b3d247
...@@ -1837,20 +1837,22 @@ static PyObject* yara_set_config( ...@@ -1837,20 +1837,22 @@ static PyObject* yara_set_config(
* options present in yara/libyara.c yr_set_configuration(...) - ck * options present in yara/libyara.c yr_set_configuration(...) - ck
*/ */
static char *kwlist[] = { static char *kwlist[] = {
"stack_size", "max_strings_per_rule", NULL}; "stack_size", "max_strings_per_rule", "max_match_data", NULL};
unsigned int stack_size = 0; unsigned int stack_size = 0;
unsigned int max_strings_per_rule = 0; unsigned int max_strings_per_rule = 0;
unsigned int max_match_data = 0;
int error = 0; int error = 0;
if (PyArg_ParseTupleAndKeywords( if (PyArg_ParseTupleAndKeywords(
args, args,
keywords, keywords,
"|II", "|III",
kwlist, kwlist,
&stack_size, &stack_size,
&max_strings_per_rule)) &max_strings_per_rule,
&max_match_data))
{ {
if (stack_size != 0) if (stack_size != 0)
{ {
...@@ -1871,6 +1873,16 @@ static PyObject* yara_set_config( ...@@ -1871,6 +1873,16 @@ static PyObject* yara_set_config(
if (error != ERROR_SUCCESS) if (error != ERROR_SUCCESS)
return handle_error(error, NULL); return handle_error(error, NULL);
} }
if (max_match_data != 0)
{
error = yr_set_configuration(
YR_CONFIG_MAX_MATCH_DATA,
&max_match_data);
if (error != ERROR_SUCCESS)
return handle_error(error, NULL);
}
} }
Py_RETURN_NONE; Py_RETURN_NONE;
...@@ -2309,7 +2321,7 @@ static PyMethodDef yara_methods[] = { ...@@ -2309,7 +2321,7 @@ static PyMethodDef yara_methods[] = {
"set_config", "set_config",
(PyCFunction) yara_set_config, (PyCFunction) yara_set_config,
METH_VARARGS | METH_KEYWORDS, METH_VARARGS | METH_KEYWORDS,
"Set a yara configuration variable (stack_size or max_strings_per_rule)" "Set a yara configuration variable (stack_size, max_strings_per_rule, or max_match_data)"
}, },
{ NULL, NULL } { NULL, NULL }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment