summaryrefslogtreecommitdiff
path: root/pcre_exec.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-05-02 17:08:52 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-05-02 17:08:52 +0000
commit312428a6f56cd0b84811f7bcae8354c56e60dff0 (patch)
treee2fd3cf7c0f387d817f1a3d975261b76b783e1cd /pcre_exec.c
parent46d492b924f785564811ab3aa3074b40fe006cd9 (diff)
downloadpcre-312428a6f56cd0b84811f7bcae8354c56e60dff0.tar.gz
Complete incomplete fix for UTF-8 caseless references of different lengths.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@597 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_exec.c')
-rw-r--r--pcre_exec.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/pcre_exec.c b/pcre_exec.c
index 0dff1af..caf5fc3 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -193,6 +193,7 @@ if ((ims & PCRE_CASELESS) != 0)
while (p < endptr)
{
int c, d;
+ if (eptr >= md->end_subject) return -1;
GETCHARINC(c, eptr);
GETCHARINC(d, p);
if (c != d && c != UCD_OTHERCASE(d)) return -1;
@@ -204,16 +205,21 @@ if ((ims & PCRE_CASELESS) != 0)
/* The same code works when not in UTF-8 mode and in UTF-8 mode when there
is no UCP support. */
-
- while (length-- > 0)
- { if (md->lcc[*p++] != md->lcc[*eptr++]) return -1; }
+ {
+ if (eptr + length > md->end_subject) return -1;
+ while (length-- > 0)
+ { if (md->lcc[*p++] != md->lcc[*eptr++]) return -1; }
+ }
}
/* In the caseful case, we can just compare the bytes, whether or not we
are in UTF-8 mode. */
else
- { while (length-- > 0) if (*p++ != *eptr++) return -1; }
+ {
+ if (eptr + length > md->end_subject) return -1;
+ while (length-- > 0) if (*p++ != *eptr++) return -1;
+ }
return eptr - eptr_start;
}