aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diffcore-pickaxe.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index 574b3e833..d0ef83970 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -25,10 +25,12 @@ static unsigned int contains(struct diff_filespec *one,
regmatch_t regmatch;
int flags = 0;
+ assert(data[sz] == '\0');
while (*data && !regexec(regexp, data, 1, &regmatch, flags)) {
flags |= REG_NOTBOL;
- data += regmatch.rm_so;
- if (*data) data++;
+ data += regmatch.rm_eo;
+ if (*data && regmatch.rm_so == regmatch.rm_eo)
+ data++;
cnt++;
}