summaryrefslogtreecommitdiff
path: root/pcregrep.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-01-15 11:22:47 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-01-15 11:22:47 +0000
commit1482ba5c96cf56eadaf32e150e989ce8975a3eaf (patch)
treeb1fcf008a3f6aa2dec2fb979cb3c20f5d6b8b8cf /pcregrep.c
parent2f6cf8f8728feed8f809ad4544ff9b5e06ef5dab (diff)
downloadpcre-1482ba5c96cf56eadaf32e150e989ce8975a3eaf.tar.gz
Another bugfix for pcregrep with -M and colour.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@588 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcregrep.c')
-rw-r--r--pcregrep.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pcregrep.c b/pcregrep.c
index 1159774..f01833d 100644
--- a/pcregrep.c
+++ b/pcregrep.c
@@ -1363,7 +1363,8 @@ while (ptr < endptr)
last_offset += offsets[1];
matchptr += offsets[1];
length -= offsets[1];
- if (!match_patterns(matchptr, length, offsets, &mrc)) break;
+ if (last_offset >= linelength + endlinelength ||
+ !match_patterns(matchptr, length, offsets, &mrc)) break;
FWRITE(matchptr, 1, offsets[0], stdout);
fprintf(stdout, "%c[%sm", 0x1b, colour_string);
FWRITE(matchptr + offsets[0], 1, offsets[1] - offsets[0], stdout);