Browse Source

instantiated reg exp pattern

pull/349/head
Logan007 4 years ago
parent
commit
e481942bf0
  1. 5
      src/n2n_regex.c
  2. 2
      src/sn_utils.c

5
src/n2n_regex.c

@ -248,8 +248,9 @@ re_t re_compile(const char* pattern)
} }
/* 'UNUSED' is a sentinel used to indicate end-of-pattern */ /* 'UNUSED' is a sentinel used to indicate end-of-pattern */
re_compiled[j].type = UNUSED; re_compiled[j].type = UNUSED;
re_t re_p = (re_t)calloc(1, sizeof(re_compiled));
return (re_t) re_compiled; memcpy (re_p, re_compiled, sizeof(re_compiled));
return (re_t) re_p;
} }
void re_print(regex_t* pattern) void re_print(regex_t* pattern)

2
src/sn_utils.c

@ -817,7 +817,7 @@ static int process_udp(n2n_sn_t * sss,
HASH_ITER(hh, sss->rules, re, tmp_re) { HASH_ITER(hh, sss->rules, re, tmp_re) {
allowed_match = re_matchp(re->rule, cmn.community, &match_length); allowed_match = re_matchp(re->rule, cmn.community, &match_length);
if(allowed_match != -1) if(allowed_match != -1) // ... && match_len == strlen(cmn.community) --- if only full matches allowed
break; break;
} }

Loading…
Cancel
Save