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

lib: fix __darr_in_vsprintf #15470

Merged
merged 2 commits into from
Mar 5, 2024
Merged

Conversation

idryzhov
Copy link
Contributor

@idryzhov idryzhov commented Mar 4, 2024

If the initial darr capacity is not enough for the output, the ap is reused multiple times, which is wrong, because it may be altered by vsnprintf. Make a copy of ap each time instead of reusing.

If the initial darr capacity is not enough for the output, the `ap` is
reused multiple times, which is wrong, because it may be altered by
`vsnprintf`. Make a copy of `ap` each time instead of reusing.

Signed-off-by: Igor Ryzhov <[email protected]>
@idryzhov
Copy link
Contributor Author

idryzhov commented Mar 4, 2024

@Mergifyio backport dev/10.0

Copy link

mergify bot commented Mar 4, 2024

backport dev/10.0

✅ Backports have been created

`darr_avail` returns the available capacity excluding the already
existing terminating NULL byte. Take this into account when using
`darr_avail`. Otherwise, if the error length is a power of 2, the
capacity is never enough and the function stucks in an infinite loop.

Signed-off-by: Igor Ryzhov <[email protected]>
@idryzhov idryzhov force-pushed the fix-darr-vsprintf branch from 65567b5 to cb6032d Compare March 5, 2024 00:08
@choppsv1 choppsv1 merged commit 21aa863 into FRRouting:master Mar 5, 2024
9 checks passed
idryzhov added a commit that referenced this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants