bcomp - general fixups and cleanup for byte compare code

pull/51/head
Mickey Sola 7 years ago committed by Micah Snyder
parent 18ff502920
commit dfa92896d2
  1. 6
      libclamav/matcher-byte-comp.c
  2. 1
      libclamav/matcher-pcre.h
  3. 6
      libclamav/matcher.c
  4. 2
      libclamav/readdb.c
  5. 2
      libclamav/str.h

@ -156,7 +156,7 @@ int cli_bcomp_addpatt(struct cli_matcher *root, const char *virname, const char
buf_start = tokens[0];
switch (buf_start[0]) {
case '<':
if ((++buf_start)[0] == '<') {
if ((++buf_start)[0] == '<') {
offset_param = strtol(++buf_start, (char**) &buf_end, 0);
if (buf_end && buf_end+1 != tokens[1]) {
cli_errmsg("cli_bcomp_addpatt: while parsing (%s#%s#%s), offset parameter included invalid characters\n", tokens[0], tokens[1], tokens[2]);
@ -176,8 +176,8 @@ int cli_bcomp_addpatt(struct cli_matcher *root, const char *virname, const char
break;
case '>':
if ((++buf_start)[0] == '>') {
offset_param = strtol(buf_start, (char**) &buf_end, 0);
if ((++buf_start)[0] == '>') {
offset_param = strtol(++buf_start, (char**) &buf_end, 0);
if (buf_end && buf_end+1 != tokens[1]) {
cli_errmsg("cli_bcomp_addpatt: while parsing (%s#%s#%s), offset parameter included invalid characters\n", tokens[0], tokens[1], tokens[2]);
free(buf);

@ -50,7 +50,6 @@ struct cli_pcre_off {
#define CLI_PCRE_GLOBAL 0x00000001 /* g */
#define CLI_PCRE_ENCOMPASS 0x00000002 /* e */
#define CLI_PCRE_ROLLING 0x00000004 /* r */
#define CLI_PCRE_BCOMP 0x00000008 /* z */
#define CLI_PCRE_DISABLED 0x80000000 /* used for dconf or fail to build */

@ -1253,11 +1253,7 @@ int cli_fmap_scandesc(cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struct cli
cli_hashset_destroy(&info.exeinfo.vinfo);
<<<<<<< HEAD
if (SCAN_ALLMATCHES && viruses_found)
=======
if (SCAN_ALL && viruses_found) {
>>>>>>> refactoring byte compare functionality as a subsig; adding loader and matchers for bytecompare subsig
if (SCAN_ALLMATCHES && viruses_found) {
return CL_VIRUS;
}
if(ret == CL_VIRUS) {

@ -606,7 +606,7 @@ int cli_parse_add(struct cli_matcher *root, const char *virname, const char *hex
} else if(root->ac_only || type || lsigid || sigopts || strpbrk(hexsig, "?([") || (root->bm_offmode && (!strcmp(offset, "*") || strchr(offset, ','))) || strstr(offset, "VI") || strchr(offset, '$')) {
if((ret = cli_ac_addsig(root, virname, hexsig, sigopts, 0, 0, 0, rtype, type, 0, 0, offset, lsigid, options))) {
cli_errmsg("cli_parse_add(): Problem adding signature (3). %s \n", hexsig);
cli_errmsg("cli_parse_add(): Problem adding signature (3).\n");
return ret;
}
} else {

@ -75,7 +75,7 @@ size_t cli_strtokenize(char *buffer, const char delim, const size_t token_count,
size_t cli_ldbtokenize(char *buffer, const char delim, const size_t token_count, const char **tokens, int token_skip);
long cli_strntol(const char* nptr, size_t n, char** endptr, register int base);
unsigned long cli_strntoul(const char* nptr, size_t n, char** endptr, register int base);
cl_errot_t cli_strntol_wrap(const char *buf, size_t buf_size, int fail_at_nondigit, int base, long *result);
cl_error_t cli_strntol_wrap(const char *buf, size_t buf_size, int fail_at_nondigit, int base, long *result);
cl_error_t cli_strntoul_wrap(const char *buf, size_t buf_size, int fail_at_nondigit, int base, unsigned long *result);
int cli_isnumber(const char *str);
char *cli_unescape(const char *str);

Loading…
Cancel
Save