Control: tags -1 + patch Please find a patch attached.
Description: Port to PCRE2. Bug-Debian: https://bugs.debian.org/1000005 Bug: https://forums.passwordmaker.org/index.php?topic=1834.0 Author: Yavor Doganov <ya...@gnu.org> Forwarded: no Last-Update: 2024-01-02 ---
--- passwordmaker-cli-1.5+dfsg.orig/unix.mak +++ passwordmaker-cli-1.5+dfsg/unix.mak @@ -34,7 +34,7 @@ LDFLAGS += $(shell dpkg-buildflags --get LDFLAGS) CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS) INCPATH = -I. -LIBS = -lmhash -lpcrecpp +LIBS = -lmhash -lpcre2-8 ifeq ($(USE_MAC), 1) CFLAGS := $(CFLAGS) -m32 --- passwordmaker-cli-1.5+dfsg.orig/urlsearch.cpp +++ passwordmaker-cli-1.5+dfsg/urlsearch.cpp @@ -24,7 +24,8 @@ #include <string> #include <iostream> #include <sstream> -#include <pcrecpp.h> +#define PCRE2_CODE_UNIT_WIDTH 8 +#include <pcre2.h> #include "stdafx.h" #include "tinyxml.h" #include "urlsearch.h" @@ -32,9 +33,24 @@ using namespace std; int UrlSearch::regexCmp(const char *regexp, const char *string) { - pcrecpp::RE re(regexp); + pcre2_code *re; + pcre2_match_data *md; + PCRE2_SPTR pat, subj; + PCRE2_SIZE offset; + int rc; - if(re.FullMatch(string)) { + pat = reinterpret_cast<PCRE2_SPTR>(regexp); + subj = reinterpret_cast<PCRE2_SPTR>(string); + re = pcre2_compile(pat, PCRE2_ZERO_TERMINATED, 0, + &rc, &offset, nullptr); + if(offset != 0) { + return 0; + } + md = pcre2_match_data_create_from_pattern(re, nullptr); + rc = pcre2_match(re, subj, PCRE2_ZERO_TERMINATED, 0, 0, md, nullptr); + pcre2_code_free(re); + pcre2_match_data_free(md); + if(rc >= 0) { return 1; } else {