Skip to content

userauth: various fixes to _libssh2_key_sign_algorithm() (cont.) - #1885

Closed
vszakats wants to merge 9 commits into
libssh2:masterfrom
vszakats:userauth-cleanup
Closed

vszakats wants to merge 9 commits into
libssh2:masterfrom
vszakats:userauth-cleanup

Conversation

@vszakats

@vszakats vszakats commented Apr 24, 2026 •

Copy link
Copy Markdown
Member
  • 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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the fixes in userauth.c around _libssh2_key_sign_algorithm() by correcting OpenSSH version parsing and tightening the sizing logic for the temporary filtered algorithm list used when intersecting server-provided server-sig-algs with locally supported algorithms.

Changes:

  • Fix OpenSSH version minor parsing in is_version_less_than_78() by using strtol() instead of single-character digit extraction.
  • Allocate the filtered_algs buffer based on session->server_sign_algorithms (the source list being filtered) rather than supported_algs.
  • Small refactors: simplify conditional expressions, inline an if block, drop redundant parentheses, and simplify the string terminator write.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats vszakats closed this in b671ac9 Apr 25, 2026
@vszakats
vszakats deleted the userauth-cleanup branch April 25, 2026 14:59
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.

2 participants