Commit 5662ba16 by Victor M. Alvarez

Allow the "match" function to accept pid=0 as an argument.

Because the function was initializing pid as 0, when the user passed pid=0 as an argument it was indistinguishable from not pid being passed at all.

Closes https://github.com/VirusTotal/yara/issues/1480
parent 1a159c3f
......@@ -1499,7 +1499,7 @@ static PyObject* Rules_match(
char* filepath = NULL;
Py_buffer data = {0};
int pid = 0;
int pid = -1;
int timeout = 0;
int error = ERROR_SUCCESS;
int fast_mode = 0;
......@@ -1535,7 +1535,7 @@ static PyObject* Rules_match(
&callback_data.which,
&callback_data.warnings_callback))
{
if (filepath == NULL && data.buf == NULL && pid == 0)
if (filepath == NULL && data.buf == NULL && pid == -1)
{
return PyErr_Format(
PyExc_TypeError,
......@@ -1646,7 +1646,7 @@ static PyObject* Rules_match(
Py_END_ALLOW_THREADS
}
else if (pid != 0)
else if (pid != -1)
{
callback_data.matches = PyList_New(0);
......@@ -1686,7 +1686,7 @@ static PyObject* Rules_match(
{
handle_error(error, filepath);
}
else if (pid != 0)
else if (pid != -1)
{
handle_error(error, "<proc>");
}
......
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