summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2020-03-27 14:35:24 +0000
committerHugo van der Sanden <hv@crypt.org>2020-03-27 14:52:25 +0000
commit51c9ef5418883d5ebb272093a628d955fe1cc323 (patch)
tree4c9f045e86ff47bd9c92aaae6eb71ba30d5b11a7 /toke.c
parente0ab3efe60276d859717e50212fa157323e89a54 (diff)
downloadperl-51c9ef5418883d5ebb272093a628d955fe1cc323.tar.gz
gh-17645: avoid oob read on conflict marker detection
Introduced in 0ae5281a2d.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toke.c b/toke.c
index a5df7ae458..953877e1c1 100644
--- a/toke.c
+++ b/toke.c
@@ -8835,7 +8835,7 @@ yyl_try(pTHX_ char *s, STRLEN len)
case '=':
if (s[1] == '=' && (s == PL_linestart || s[-1] == '\n')
- && memBEGINs(s + 2, (STRLEN) (PL_bufend - s + 2), "====="))
+ && memBEGINs(s + 2, (STRLEN) (PL_bufend - (s + 2)), "====="))
{
s = vcs_conflict_marker(s + 7);
goto retry;
@@ -8929,7 +8929,7 @@ yyl_try(pTHX_ char *s, STRLEN len)
case '<':
if (s[1] == '<' && (s == PL_linestart || s[-1] == '\n')
- && memBEGINs(s+2, (STRLEN) (PL_bufend - (s+2)), "<<<<<"))
+ && memBEGINs(s + 2, (STRLEN) (PL_bufend - (s + 2)), "<<<<<"))
{
s = vcs_conflict_marker(s + 7);
goto retry;
@@ -8938,7 +8938,7 @@ yyl_try(pTHX_ char *s, STRLEN len)
case '>':
if (s[1] == '>' && (s == PL_linestart || s[-1] == '\n')
- && memBEGINs(s + 2, (STRLEN) (PL_bufend - s + 2), ">>>>>"))
+ && memBEGINs(s + 2, (STRLEN) (PL_bufend - (s + 2)), ">>>>>"))
{
s = vcs_conflict_marker(s + 7);
goto retry;