aboutsummaryrefslogtreecommitdiffstats
path: root/testing/hylafaxplus/musl-reg-startend.patch
blob: f101a83d95ffd5ec0c9635c59729bb636584b6a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);