Repository navigation
Conversation
- scope variables. - dedupe constant and replace magic number with `sizeof()`. - drop useless check for non-NULL `filtered_algs`. - fix leaking `filtered_algs` on an error path. Follow-up to 3a6ab70 libssh2#1314
There was a problem hiding this comment.
Pull request overview
This PR tightens and corrects _libssh2_key_sign_algorithm() in src/userauth.c, primarily fixing comparison logic and cleaning up memory handling while keeping the intended OpenSSH compatibility behavior intact.
Changes:
- Replaced hard-coded lengths with
sizeof(...)-1constants and deduped repeated string literals. - Fixed incorrect
memcmp()usage (wrong pointer, wrong truthiness check) and added a missing NULL-check before freeing/using*key_method. - Fixed an error-path leak of
filtered_algsand simplified cleanup on exit.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- size the `filtered-algs` buffer by the server list rather than the supported list, since the output is always a subset of the server list byte-for-byte. Report-and-patch-by: Kit Knox - use `strttol()` to extract minor version too. Pointed out by GitHub Code Quality. Also: - rename a variable. - simplify an expression. - inline an `if` block. - drop redundant parentheses. Follow-up to ba2a7ff #1881 Follow-up to 3a6ab70 #1314 Closes #1885
sizeof().filtered_algson exit.filtered_algson an error path.*key_methodtomemcmp()(was:key_method).memcmp()against0(was: non-zero).*key_method.*key_methodNULL-check after use.Ref: #1314 (comment)
Ref: #1877 (comment)
Ref: #1877 (comment)
Follow-up to 3a6ab70 #1314
FIXME?: The comment and code about
SSH_BUG_SIGTYPEseem to benot in sync with each other.
/cc @Tejaswikandula