VirusTotal / yara

The pattern matching swiss knife
https://virustotal.github.io/yara/
BSD 3-Clause "New" or "Revised" License
8.08k stars 1.43k forks source link

string memory of yara cli not correctly freed #1963

Open z16166 opened 11 months ago

z16166 commented 11 months ago

At the very end of _tmain() in yara cli, there is the following line: args_free(options);

Here is the body of args_free():

void args_free(args_option_t* options)
{
  for (; options->type != ARGS_OPT_END; options++)
  {
    if (options->type == ARGS_OPT_STRING && options->value != NULL)
    {
      free(options->value);
    }
  }
}

If options->type is ARGS_OPT_STRING , options->value will point to an array of pointer "ext_vars": static char* ext_vars[MAX_ARGS_EXT_VAR + 1];

so there may be leaks?