Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Could cause OOB read in clients] Fix incorrect positive error code from pcre2_substitute() #481

Merged

Conversation

NWilson
Copy link
Contributor

@NWilson NWilson commented Sep 18, 2024

This has minor security implications.

pcre2_substitute() calls check_escape() which returns a positive compile-error. Unfortunately, this is returned back to the pcre2_substitute() caller, which interprets a non-negative code as meaning "substitute succeeded".

This could cause the client to process the return string, assuming that it is null-terminated, and perform an out-of-bounds read.

Clients which use the *blength parameter to determine the length of the returned string are unaffected.

The pcre2test application was itself affected: it would print garbage memory because it relies on the null terminator when pcre2_substitute() returns non-negative.

@NWilson NWilson changed the title [Could case OOB read in clients] Fix incorrect positive error code from pcre2_substitute() [Could cause OOB read in clients] Fix incorrect positive error code from pcre2_substitute() Sep 18, 2024
@PhilipHazel PhilipHazel merged commit 829414f into PCRE2Project:master Sep 18, 2024
12 checks passed
@NWilson NWilson deleted the user/niwilson/bad-subst-escape branch September 23, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants