instantiated reg exp pattern

This commit is contained in:
Logan007 2020-08-06 00:34:17 +05:45
parent 1b3e485da6
commit e481942bf0
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -817,7 +817,7 @@ static int process_udp(n2n_sn_t * sss,
HASH_ITER(hh, sss->rules, re, tmp_re) {
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;
}