[Privoxy-commits] [privoxy] 09/10: pcre2 compile_pattern(): Actually pass the anchored pattern to pcre2_compile()

User Git git at git.privoxy.org
Sun Aug 27 12:59:15 CEST 2023


This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository privoxy.

commit e73b93ea9ad1f3e980bd78ed3ebf65dedbb598a2
Author: Fabian Keil <fk at fabiankeil.de>
AuthorDate: Sun Aug 27 12:26:02 2023 +0200

    pcre2 compile_pattern(): Actually pass the anchored pattern to pcre2_compile()
    
    Previously the un-anchoring pattern was compiled resulting
    in incorrect matches.
    
    For example requests to:
    
        https://www.privoxy.org/user-manual/config.html
    
    were redirected because of the default.action section:
    
        {+redirect{http://config.privoxy.org/}}
        # Sticky Actions = +redirect{http://config.privoxy.org/}
        # URL = http://www.privoxy.org/config
        # Redirected URL = http://www.privoxy.org/config
        # Redirect Destination = http://config.privoxy.org/
        .privoxy.org/config
    
    As the path pattern is left-anchored it should not match.
---
 urlmatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/urlmatch.c b/urlmatch.c
index 22feb9c8..494a69a9 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -666,7 +666,7 @@ static jb_err compile_pattern(const char *pattern, enum regex_anchoring anchorin
 
    snprintf(rebuf, rebuf_size, fmt, pattern);
 
-   *regex = pcre2_compile((const unsigned char *)pattern,
+   *regex = pcre2_compile((const unsigned char *)rebuf,
       PCRE2_ZERO_TERMINATED, PCRE2_CASELESS, &errcode,
       &error_offset, NULL);
    if (*regex == NULL)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Privoxy-commits mailing list