aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-10-01 19:21:13 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-19 22:01:28 +0200
commit9675391c65f70bf8071bd70f669c2d821ffaa508 (patch)
tree698f522ba9d4b72d51ed982edf8138096debd8cc
parentd4accfc130fe4787f20b8ab1152a70157d45c90a (diff)
downloadlibssh-9675391c65f70bf8071bd70f669c2d821ffaa508.tar.gz
libssh-9675391c65f70bf8071bd70f669c2d821ffaa508.tar.xz
libssh-9675391c65f70bf8071bd70f669c2d821ffaa508.zip
pki: Add NULL check in ssh_pki_key_ecdsa_name()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/pki.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pki.c b/src/pki.c
index d5c13048..d420e792 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -91,10 +91,13 @@ enum ssh_keytypes_e pki_privatekey_type_from_string(const char *privkey) {
*/
const char *ssh_pki_key_ecdsa_name(const ssh_key key)
{
+ if (key == NULL) {
+ return NULL;
+ }
+
#ifdef HAVE_ECC /* FIXME Better ECC check needed */
return pki_key_ecdsa_nid_to_name(key->ecdsa_nid);
#else
- (void) key; /* unused */
return NULL;
#endif
}