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 crash under _FORTIFY_SOURCE #1953

Merged
merged 1 commit into from
Nov 12, 2024
Merged

Conversation

N-R-K
Copy link
Collaborator

@N-R-K N-R-K commented Nov 11, 2024

when built with _FORTIFY_SOURCE it will check whether the buffer has as much space as the argument passed to snprintf: https://github.com/bminor/glibc/blob/7b544224f82d20019f9b28522ebf8114a372d1a2/debug/snprintf_chk.c#L28-L29

this results in some false positives when the snprintf provided len argument is bigger than the buffer size (but the result would have fit into the buffer anyways).

fix this by passing the proper size to snprintf as argument. (the +1 len isn't necessary, but add it just in case.)

Fixes: #1931

when built with _FORTIFY_SOURCE it will check whether the buffer
has as much space as the argument passed to snprintf:

	https://github.com/bminor/glibc/blob/7b544224f82d20019f9b28522ebf8114a372d1a2/debug/snprintf_chk.c#L28-L29

this results in some false positives when the snprintf provided
len argument is bigger than the buffer size (but the result
would have fit into the buffer anyways).

fix this by passing the proper size to snprintf as argument.
(the +1 len isn't necessary, but add it just in case.)

Fixes: jarun#1931
src/nnn.c Dismissed Show dismissed Hide dismissed
@jarun jarun merged commit 9db87a7 into jarun:master Nov 12, 2024
7 checks passed
@jarun
Copy link
Owner

jarun commented Nov 12, 2024

Thank you!

@N-R-K N-R-K deleted the fix-fortify-abortion branch November 12, 2024 05:43
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.

Crash When Attempting to Archive
2 participants