aboutsummaryrefslogtreecommitdiffstats
path: root/main/hylafaxplus/musl-reg-startend.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/hylafaxplus/musl-reg-startend.patch')
-rw-r--r--main/hylafaxplus/musl-reg-startend.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/main/hylafaxplus/musl-reg-startend.patch b/main/hylafaxplus/musl-reg-startend.patch
new file mode 100644
index 0000000000..f101a83d95
--- /dev/null
+++ b/main/hylafaxplus/musl-reg-startend.patch
@@ -0,0 +1,20 @@
+diff --git a/util/RE.c++ b/util/RE.c++
+index 77150e8..6a11b1c 100644
+--- a/util/RE.c++
++++ b/util/RE.c++
+@@ -77,8 +77,13 @@ RE::Find(const char* text, u_int length, u_int off)
+ else {
+ matches[0].rm_so = off;
+ matches[0].rm_eo = length;
+- execResult = regexec(&c_pattern, text, c_pattern.re_nsub+1,
+- matches, REG_STARTEND);
++ char newtext[length-off+1];
++ strncpy(newtext,&text[off],length-off);
++ newtext[length-off]='\0';
++ execResult = regexec(&c_pattern, newtext, c_pattern.re_nsub+1,
++ matches, 0x0);
++ for (int j=0;j<c_pattern.re_nsub+1;j++)
++ matches[j].rm_so+=off, matches[j].rm_eo+=off;
+ }
+ }
+ return (execResult == 0);