Fix off-by-one bug in pcre2_substitute().

This commit is contained in:
Philip.Hazel 2015-11-01 16:36:20 +00:00
parent f72b753f73
commit a0d04b9fa3
2 changed files with 5 additions and 2 deletions

View File

@ -245,6 +245,9 @@ digit was given after the decimal point, or if more than two digits were given.
It now works with one or two digits, and gives a compile time error if more are
given.
71. In pcre2_substitute() there was the possibility of reading one code unit
beyond the end of the replacement string.
Version 10.20 30-June-2015
--------------------------

View File

@ -427,8 +427,8 @@ do
{
name[n++] = next;
if (n > 32) goto BAD;
if (ptr >= repend) break;
next = *(++ptr);
if (++ptr >= repend) break;
next = *ptr;
}
if (n == 0) goto BAD;
name[n] = 0;