From 43bb005b454a0caa4c0e7add2868d1c54a07b1d9 Mon Sep 17 00:00:00 2001 From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net> Date: Sat, 11 Apr 2020 23:50:51 +0700 Subject: [PATCH] [*] Check for NULL key --- src/dap_enc_key.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dap_enc_key.c b/src/dap_enc_key.c index 3f9b912..60c756d 100755 --- a/src/dap_enc_key.c +++ b/src/dap_enc_key.c @@ -322,6 +322,10 @@ uint8_t* dap_enc_key_serealize_priv_key(dap_enc_key_t *a_key, size_t *a_buflen_o uint8_t* dap_enc_key_serealize_pub_key(dap_enc_key_t *a_key, size_t *a_buflen_out) { uint8_t *data = NULL; + if ( a_key->pub_key_data ){ + log_it(L_ERROR, "Public key is NULL"); + return NULL; + } switch (a_key->type) { case DAP_ENC_KEY_TYPE_SIG_BLISS: data = dap_enc_sig_bliss_write_public_key(a_key->pub_key_data, a_buflen_out); -- GitLab