summaryrefslogtreecommitdiff
blob: 546274709b9bcb0ed2917729d58ab931343457e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- sbr/m_getfld.orig.c	2004-07-25 13:18:04.570397179 -0700
+++ sbr/m_getfld.c	2004-07-25 13:25:36.471839770 -0700
@@ -730,18 +730,18 @@
 	register char *ep = pat + patln;
 	register char pc = *pat++;
 
-	for(;;) {
-		while (pc != *str++)
-			if (str > es)
-				return 0;
+	for(;str <= es; str++) {
+		if (pc != *str)
+			continue;
 		if (str > es+1)
 			return 0;
-		sp = str; pp = pat;
+		sp = str+1; pp = pat;
 		while (pp < ep && *sp++ == *pp)
 			pp++;
 		if (pp >= ep) 
-			return ((unsigned char *)--str);
+			return ((unsigned char *)str);
 	}
+	return 0;
 }