general code clean-up and adjustments

remotes/push_mirror/swebb/clamyara^2
Kevin Lin 11 years ago
parent ea3d1e7254
commit e1ab4becdb
  1. 10
      libclamav/matcher-ac.c
  2. 2
      libclamav/matcher-pcre.c
  3. 18
      libclamav/regex_pcre.c
  4. 2
      libclamav/regex_pcre.h

@ -1359,9 +1359,9 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v
if(res) {
newres = (struct cli_ac_result *) malloc(sizeof(struct cli_ac_result));
if(!newres) {
cli_errmsg("cli_ac_scanbuff: Can't allocate memory for newres %lu\n", sizeof(struct cli_ac_result));
cli_errmsg("cli_ac_scanbuff: Can't allocate memory for newres %lu\n", (unsigned long)sizeof(struct cli_ac_result));
return CL_EMEM;
}
}
newres->virname = pt->virname;
newres->customdata = pt->customdata;
newres->next = *res;
@ -1412,9 +1412,9 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v
if(res) {
newres = (struct cli_ac_result *) malloc(sizeof(struct cli_ac_result));
if(!newres) {
cli_errmsg("cli_ac_scanbuff: Can't allocate memory for newres %lu\n", sizeof(struct cli_ac_result));
return CL_EMEM;
}
cli_errmsg("cli_ac_scanbuff: Can't allocate memory for newres %lu\n", (unsigned long)sizeof(struct cli_ac_result));
return CL_EMEM;
}
newres->virname = pt->virname;
newres->customdata = pt->customdata;
newres->offset = realoff;

@ -336,7 +336,7 @@ int cli_pcre_addpatt(struct cli_matcher *root, const char *trigger, const char *
return CL_SUCCESS;
}
int cli_pcre_build(struct cli_matcher *root, long long unsigned match_limit, long long unsigned recmatch_limit, const struct cli_dconf *dconf)
int cli_pcre_build(struct cli_matcher *root, long long unsigned match_limit, long long unsigned recmatch_limit, const struct cli_dconf *dconf)
{
unsigned int i;
int ret;

@ -45,24 +45,6 @@ int cli_pcre_init()
return CL_SUCCESS;
}
/* TODO: function is kinda pointless, remove or rework? */
int cli_pcre_parse(struct cli_pcre_data *pd, const char *pattern)
{
if (!pd || !pattern) {
cli_errmsg("cli_pcre_parse: NULL pd or NULL pattern\n");
return CL_ENULLARG;
}
/* copy expression to struct cli_pcre_data */
pd->expression = cli_strdup(pattern);
if (!(pd->expression)) {
cli_errmsg("cli_pcre_parse: Unable to allocate memory\n");
return CL_EMEM;
}
return CL_SUCCESS;
}
int cli_pcre_addoptions(struct cli_pcre_data *pd, const char **opt, int errout)
{
if (!pd || !opt || !(*opt))

@ -48,7 +48,7 @@ struct cli_pcre_data {
uint32_t search_offset; /* start offset to search at for pcre_exec */
};
int cli_pcre_parse(struct cli_pcre_data *pd, const char *pattern);
int cli_pcre_init();
int cli_pcre_addoptions(struct cli_pcre_data *pd, const char **opt, int errout);
int cli_pcre_compile(struct cli_pcre_data *pd, long long unsigned match_limit, long long unsigned match_limit_recursion, unsigned int options, int opt_override);
int cli_pcre_match(struct cli_pcre_data *pd, const unsigned char *buffer, uint32_t buflen, int override_offset, int options, int *ovector, size_t ovlen);

Loading…
Cancel
Save