Skip to content

Commit

Permalink
pcre2test: avoid overreading subject buffer with leading spaces (#430)
Browse files Browse the repository at this point in the history
If any spaces are skipped at the beginning, make sure to account
for the reduced size of the remaining data as the pointer is
moved forward.
  • Loading branch information
carenas committed Jun 19, 2024
1 parent 7e14196 commit 9a51f31
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pcre2test.c
Original file line number Diff line number Diff line change
Expand Up @@ -6920,7 +6920,11 @@ len = strlen((const char *)buffer);
while (len > 0 && isspace(buffer[len-1])) len--;
buffer[len] = 0;
p = buffer;
while (isspace(*p)) p++;
while (isspace(*p))
{
p++;
len--;
}

/* Check that the data is well-formed UTF-8 if we're in UTF mode. To create
invalid input to pcre2_match(), you must use \x?? or \x{} sequences. */
Expand Down

0 comments on commit 9a51f31

Please sign in to comment.