isisd: Fix remaining buffer size calculation in lsp_bits2string - #20984
Merged
Conversation
Greptile SummaryThis PR fixes a critical buffer overflow vulnerability in the Key changes:
The fix is straightforward and correct: when Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 729574a |
mjstapp
reviewed
Mar 2, 2026
The lsp_bits2string function was incorrectly passing the total buf_size to subsequent snprintf calls instead of the remaining buffer space. This caused the compiler's _FORTIFY_SOURCE security checks to trigger a SIGABRT, as the requested write size exceeded the bounds of the buffer. This issue was exposed after switching the compiler from GCC to Clang on Ubuntu 24.04. Instead of fixing the pointer arithmetic, just refactor the function to use a single snprintf call. Signed-off-by: Renato Botelho do Couto <renato@netgate.com>
mjstapp
approved these changes
Mar 2, 2026
mjstapp
left a comment
Contributor
There was a problem hiding this comment.
thanks, looks good
(and I don't mind the line-break that clang-format complains about)
Contributor
|
@Mergifyio backport dev/10.6 |
β Backports have been createdDetails
|
riw777
added a commit
that referenced
this pull request
Mar 3, 2026
isisd: Fix remaining buffer size calculation in lsp_bits2string (backport #20984)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The lsp_bits2string function was incorrectly passing the total
buf_size to subsequent snprintf calls instead of the remaining
buffer space. This caused the compiler's _FORTIFY_SOURCE security
checks to trigger a SIGABRT, as the requested write size exceeded
the actual remaining bounds of the buffer.
I started seeing this crash after building FRR with clang 18 on
Ubuntu 24.04.
Corrected the size argument by properly subtracting the already
consumed space (pos - buf) from the total buf_size.
Related Issue
Components
isisd