Ettercap/ettercap

pcre2 mixing of length and compile options

loqs opened this issue · 2 comments

loqs commented

The second option to pcre2_compile is the length of the string or PCRE2_ZERO_TERMINATED.
The third field is the option bits.

https_url_pcre = pcre2_compile(URL_PATTERN, PCRE2_MULTILINE|PCRE2_CASELESS|PCRE2_ZERO_TERMINATED, 0, &error, &erroroffset, NULL);

has option bits PCRE2_MULTILINE|PCRE2_CASELESS in the second field and sets no options in the third. I believe PCRE2_MULTILINE|PCRE2_CASELESS should be moved to the third field.
The following also have the same issue but in these cases I believe PCRE2_MULTILINE|PCRE2_CASELESS should be dropped instead of moved, so the code matches pcre_compile.
fop[i].op.func.ropt->pregex = pcre2_compile(fop[i].op.func.string, PCRE2_MULTILINE|PCRE2_CASELESS|PCRE2_ZERO_TERMINATED, 0, &perrbuf, &err, NULL );

pregex = pcre2_compile(fop->op.func.string, PCRE2_MULTILINE|PCRE2_CASELESS|PCRE2_ZERO_TERMINATED, 0, &errbuf, &erroff, NULL );

pregex = pcre2_compile(fop->op.func.string, PCRE2_MULTILINE|PCRE2_CASELESS|PCRE2_ZERO_TERMINATED, 0, &errbuf, &erroff, NULL );

@loqs good catch. Thanks.
Can you verify if #1216 would fix this?

also #1217 , there was another PCRE2_MULTILINE used and not in sync with pcre_compile