Skip to content

openssl: handle OOM and EVP_PKEY_get_octet_string_param() fail in ossl_ecdsa_evp_to_pubkey() - #2542

Closed
vszakats wants to merge 1 commit into
libssh2:masterfrom
vszakats:ossl-errcheck
Closed

vszakats wants to merge 1 commit into
libssh2:masterfrom
vszakats:ossl-errcheck

Conversation

@vszakats

Copy link
Copy Markdown
Member

Follow-up to b0ab005 #1207


Before the LLM points it out: I'm aware there is an alloc/free mismatch when using OpenSSL 3.

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

Adds error handling for OpenSSL 3 ECDSA public-key extraction.

Changes:

  • Handles allocation failure.
  • Checks EVP_PKEY_get_octet_string_param() failure.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/openssl.c Resolved

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread src/openssl.c
EVP_PKEY_get_octet_string_param(pk, OSSL_PKEY_PARAM_PUB_KEY,
octal_value, octal_len, &octal_len);
if(!octal_value) {
rc = -1;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Dang, another error value confusion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's a total mess. Not tackling this in this PR.

Comment thread src/openssl.c
if(EVP_PKEY_get_octet_string_param(pk, OSSL_PKEY_PARAM_PUB_KEY,
octal_value,
octal_len, &octal_len) <= 0) {
rc = -1;
@vszakats vszakats closed this in 9b51b95 Aug 27, 2026
@vszakats
vszakats deleted the ossl-errcheck branch August 27, 2026 10:22
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