@@ -1837,20 +1837,22 @@ static PyObject* yara_set_config(
1837
1837
* options present in yara/libyara.c yr_set_configuration(...) - ck
1838
1838
*/
1839
1839
static char * kwlist [] = {
1840
- "stack_size" , "max_strings_per_rule" , NULL };
1840
+ "stack_size" , "max_strings_per_rule" , "max_match_data" , NULL };
1841
1841
1842
1842
unsigned int stack_size = 0 ;
1843
1843
unsigned int max_strings_per_rule = 0 ;
1844
+ unsigned int max_match_data = 0 ;
1844
1845
1845
1846
int error = 0 ;
1846
1847
1847
1848
if (PyArg_ParseTupleAndKeywords (
1848
1849
args ,
1849
1850
keywords ,
1850
- "|II " ,
1851
+ "|III " ,
1851
1852
kwlist ,
1852
1853
& stack_size ,
1853
- & max_strings_per_rule ))
1854
+ & max_strings_per_rule ,
1855
+ & max_match_data ))
1854
1856
{
1855
1857
if (stack_size != 0 )
1856
1858
{
@@ -1871,6 +1873,16 @@ static PyObject* yara_set_config(
1871
1873
if (error != ERROR_SUCCESS )
1872
1874
return handle_error (error , NULL );
1873
1875
}
1876
+
1877
+ if (max_match_data != 0 )
1878
+ {
1879
+ error = yr_set_configuration (
1880
+ YR_CONFIG_MAX_MATCH_DATA ,
1881
+ & max_match_data );
1882
+
1883
+ if (error != ERROR_SUCCESS )
1884
+ return handle_error (error , NULL );
1885
+ }
1874
1886
}
1875
1887
1876
1888
Py_RETURN_NONE ;
@@ -2309,7 +2321,7 @@ static PyMethodDef yara_methods[] = {
2309
2321
"set_config" ,
2310
2322
(PyCFunction ) yara_set_config ,
2311
2323
METH_VARARGS | METH_KEYWORDS ,
2312
- "Set a yara configuration variable (stack_size or max_strings_per_rule )"
2324
+ "Set a yara configuration variable (stack_size, max_strings_per_rule, or max_match_data )"
2313
2325
},
2314
2326
{ NULL , NULL }
2315
2327
};
0 commit comments