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 potential out-of-bounds access in strncmp() #148

Merged
merged 1 commit into from
Aug 10, 2024

Conversation

visitorckw
Copy link
Contributor

The current strncmp() implementation may continue comparing strings when they are identical and shorter than 'len', leading to potential out-of-bounds memory access. For example, strncmp("abc", "abc", 5) could access memory beyond the end of the strings.

Add a check to return 0 if the end of either string is reached before 'len', preventing unintended memory access.

The current strncmp() implementation may continue comparing strings
when they are identical and shorter than 'len', leading to potential
out-of-bounds memory access. For example, strncmp("abc", "abc", 5)
could access memory beyond the end of the strings.

Add a check to return 0 if the end of either string is reached before
'len', preventing unintended memory access.
@jserv jserv merged commit 4b8c4e6 into sysprog21:master Aug 10, 2024
4 checks passed
@visitorckw visitorckw deleted the fix-strncmp branch August 10, 2024 16:59
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