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

Fix xbcloud out of range memory read #1538

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

imrivera
Copy link

@imrivera imrivera commented Jan 17, 2024

Fix a memory out of bounds read when chunk_name.size() < 21

- if (chunk_name.size() < 22 && chunk_name[chunk_name.size() - 21] != '.') {
+ if (chunk_name.size() < 22 || chunk_name[chunk_name.size() - 21] != '.') {
chunk_name.size() Before (&&) After (||)
< 21 - 1st condition is true
- 2nd condition use negative index
- 1st condition is true
- 2nd condition not evaluated
== 21 - 1st condition is true
- 2nd condition using index 0, ok but useless if we want names longer than 21 chars
- 1st condition is true
- 2nd condition not evaluated
>= 22 - 1st condition is false
- 2nd condition is not evaluated
- 1st condition is false
- 2nd condition is evaluated with an index always > 0

@it-percona-cla
Copy link

it-percona-cla commented Jan 17, 2024

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants