Skip to content

kex: NULL check data in kex_mlkem768x25519_sha256() to match siblings - #2215

Closed
vszakats wants to merge 1 commit into
libssh2:masterfrom
vszakats:kexdatanullcheck
Closed

vszakats wants to merge 1 commit into
libssh2:masterfrom
vszakats:kexdatanullcheck

Conversation

@vszakats

@vszakats vszakats commented Jul 5, 2026 •

Copy link
Copy Markdown
Member

Suggested by GitHub Code Quality

Follow-up to 3ba252e #1644

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 pull request hardens the hybrid KEX implementation by adding an explicit NULL check for the host-key reply packet buffer (data) in kex_mlkem768x25519_sha256(), aligning its behavior and error reporting with other KEX implementations in src/kex.c.

Changes:

  • Add a guard clause in kex_mlkem768x25519_sha256() to error out early when data == NULL.
  • Return a consistent protocol error (LIBSSH2_ERROR_PROTO) with message "Missing host key data" as used by sibling KEX paths.

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

@vszakats

vszakats commented Jul 5, 2026 •

Copy link
Copy Markdown
Member Author

Seen test_ssh2 fail in job 'freebsd 15.1, AM clang openssl x86_64' the second time:
https://github.com/libssh2/libssh2/actions/runs/28745018411/job/85234337471?pr=2215

First time:
https://github.com/libssh2/libssh2/actions/runs/28740149966/job/85221371725
aft commit 'src: move static function names to local namespace, where missing'.

(no leads in the log)

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