summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pki.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pki.c b/src/pki.c
index 6883a21..095a8dc 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -510,6 +510,7 @@ int ssh_pki_import_pubkey_base64(ssh_session session,
enum ssh_keytypes_e type,
ssh_key *pkey) {
ssh_buffer buffer;
+ ssh_string type_s;
int rc;
if (session == NULL || b64_key == NULL || pkey == NULL) {
@@ -517,6 +518,16 @@ int ssh_pki_import_pubkey_base64(ssh_session session,
}
buffer = base64_to_bin(b64_key);
+ if (buffer == NULL) {
+ return SSH_ERROR;
+ }
+
+ type_s = buffer_get_ssh_string(buffer);
+ if (type_s == NULL) {
+ ssh_buffer_free(buffer);
+ return SSH_ERROR;
+ }
+ ssh_string_free(type_s);
rc = pki_import_pubkey_buffer(session, buffer, type, pkey);
ssh_buffer_free(buffer);