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 bounds checks in BMI270 driver in bulk_read #362

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

jabberrock
Copy link
Contributor

@jabberrock jabberrock commented Nov 11, 2024

Both i and bytes_to_read are size_t, which are unsigned long. i - bytes_to_read always underflows and should have been bytes_to_read - i for how many bytes are left in the buffer. But since we're dealing with unsigned values, it's safer to only do additions and comparisons.

Both i and bytes_to_read are size_t, which are unsigned long. `i - bytes_to_read` should have been `bytes_to_read - i` for how many bytes are left in the buffer. But since we're dealing with unsigned values, it's safer to only do additions and comparisons.
Copy link
Contributor

@l0ud l0ud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ButterscotchV ButterscotchV merged commit 11b846f into SlimeVR:main Nov 20, 2024
2 checks passed
@jabberrock
Copy link
Contributor Author

Thanks for reviewing and merging @ButterscotchV !

@jabberrock jabberrock deleted the jabber-bmi270-bounds-checks branch November 20, 2024 20:05
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.

3 participants