1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-17 04:22:32 +03:00

Always init mbedtls_pk_context (#1430)

In the failure case, mbedtls_pk_context could be free'd without first being initialized.
This commit is contained in:
Will Cosgrove
2024-07-23 10:32:13 -07:00
committed by GitHub
parent 457b02e8dd
commit a50d7debfd

View File

@@ -1297,12 +1297,12 @@ _libssh2_mbedtls_ecdsa_new_private(libssh2_ecdsa_ctx **ctx,
unsigned char *data = NULL;
size_t data_len = 0;
mbedtls_pk_init(&pkey);
/* FIXME: Reimplement this functionality via a public API. */
if(mbedtls_pk_load_file(filename, &data, &data_len))
goto cleanup;
mbedtls_pk_init(&pkey);
if(_libssh2_mbedtls_parse_eckey(ctx, &pkey, session,
data, data_len, pwd) == 0)
goto cleanup;