Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adjusts the mbedTLS ECDSA signature encoding helper in src/mbedtls.c to add explicit buffer-length bounds checks, consolidate conditional logic, and rename variables for improved readability while writing MPIs into the SSH wire-format signature buffer.
Changes:
- Extend
mbed_mpi_write_binary()to accept an explicitbuf_lenand add bounds checks. - Consolidate conditional branches around MPI writing and leading-zero stripping.
- Update ECDSA signing code to use the revised helper signature.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vszakats
force-pushed
the
mbed-wr-fix-boundary-check
branch
3 times, most recently
from
July 12, 2026 20:36
fa540a0 to
a82d7c8
Compare
vszakats
force-pushed
the
mbed-wr-fix-boundary-check
branch
from
July 12, 2026 20:55
3db7949 to
2abebd3
Compare
mbedtls.c fix bounds check in mbed_mpi_write_binary "The condition `sizeof(&p) / sizeof(p[0])` computes the size of a pointer divided by the size of `unsigned char` (which is 1), yielding 4 on 32-bit or 8 on 64-bit platforms. This expression is never less than 4 on any supported architecture, so the guard `goto done` is dead code and the function always proceeds to write to `p` without the intended safety check. The intended check is likely a compile-time buffer size guard and should be reformulated correctly." rename to try fix clang-tidy false positive cleanups backtrack on rename for a cleaner diff fixups sync with openssl
vszakats
force-pushed
the
mbed-wr-fix-boundary-check
branch
from
July 12, 2026 21:28
2abebd3 to
767e111
Compare
mbed_mpi_write_binary()mbed_mpi_write_binary()
mbed_mpi_write_binary()mbed_mpi_write_binary(), sync with ossl_write_bn()
mbed_mpi_write_binary(), sync with ossl_write_bn()mbed_mpi_write_binary()
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.
To sync with
ossl_write_bn()sibling function.Reported by GitHub Code Quality
Follow-up to 5528f3d #385
https://github.com/libssh2/libssh2/pull/2278/files?w=1