Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Explorer09
Copy link
Contributor

This makes xSnprintf more robust against large input buffer sizes. There is an API defect in the snprintf() function, of which the return type is signed int and not size_t. If the specified input buffer length is > INT_MAX, the behavior is undefined in standard C. (In POSIX, the function would fail with errno = EOVERFLOW.) Rather than let the caller ensure the buffer length is <= INT_MAX, it's better to let xSnprintf() clamp the buffer length.

@BenBE BenBE added the enhancement Extension or improvement to existing feature label Sep 22, 2025
@BenBE BenBE added this to the 3.5.0 milestone Sep 26, 2025
This makes xSnprintf more robust against large input buffer sizes.
There is an API defect in the snprintf() function, of which the return
type is signed int and not size_t. If the specified input buffer length
is > INT_MAX, the behavior is undefined in standard C. (In POSIX, the
function would fail with errno = EOVERFLOW.) Rather than let the caller
ensure the buffer length is <= INT_MAX, it's better to let xSnprintf()
clamp the buffer length.
@natoscott natoscott marked this pull request as ready for review October 9, 2025 07:27
@natoscott natoscott merged commit 7c6c9d3 into htop-dev:main Oct 9, 2025
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Extension or improvement to existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants