-
Notifications
You must be signed in to change notification settings - Fork 938
printf.c: fix off-by-one + underflow errors #13592
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
base: main
Are you sure you want to change the base?
Conversation
Thanks to @Finder16 for reporting these off-by-one and underflow errors. Signed-off-by: Jeff Squyres <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes two critical bugs in the opal_vsnprintf function: an off-by-one error that caused out-of-bounds memory access when writing the null terminator, and an underflow issue when the buffer size is zero.
- Fixed off-by-one error in null terminator placement from
str[size]tostr[size - 1] - Added
size > 0check to prevent underflow when calculatingsize - 1with unsignedsize_t
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Port of open-mpi/ompi#13592 Signed-off-by: Ralph Castain <[email protected]>
Port of open-mpi/ompi#13592 Signed-off-by: Ralph Castain <[email protected]>
Port of open-mpi/ompi#13592 Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit 78af01e)
Port of open-mpi/ompi#13592 Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit 78af01e)
Port of open-mpi/ompi#13592 Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit 78af01e)
Thanks to @Finder16 for reporting these off-by-one and underflow errors.